-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
73 lines (67 loc) · 2.54 KB
/
config-overrides.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// const path = require('path');
// const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
// const CACHE_ID = 'nem2-dev-ui';
module.exports = function override(config, env) {
console.debug({ config, env });
// console.debug(config.module);
// console.debug(config.resolveLoader);
// config.module.rules = [...config.module.rules,
/// ]
// const isEnvDevelopment = env === 'development';
// const isEnvProduction = env === 'production';
// config.resolve = {
// ...config.resolve,
// alias: { '@': path.resolve(__dirname, 'src') },
// };
// if(isEnvProduction) {
// const publicUrl = isEnvProduction
// ? config.output.publicPath.slice(0, -1)
// : isEnvDevelopment && '';
// const alterWorkboxWebpackPlugin = new WorkboxWebpackPlugin.GenerateSW({
// cacheId: CACHE_ID,
// globDirectory: 'build',
// globPatterns: [
// "assets/**/*.{html,json,js,css,jpg,png,gif,webp,svg,ttf,woff,ico}"
// ],
// // include: [/.+\.(html|json|js|css|jpg|png|gif|svg|woff)$/],
// clientsClaim: true,
// skipWaiting: true,
// exclude: [/\.map$/, /asset-manifest\.json$/],
// importWorkboxFrom: 'cdn',
// navigateFallback: publicUrl + '/index.html',
// navigateFallbackBlacklist: [new RegExp('^/_'), new RegExp('/[^/]+\\.[^/]+$')],
// runtimeCaching: [
// { urlPattern: /.+(\/|.html|.json)$/,
// handler: "NetworkFirst",
// options: {
// cacheName: CACHE_ID + "-html-cache",
// expiration: { maxAgeSeconds: 30 * 60 * 60 * 24 }
// },
// },
// { urlPattern: /.+\.(js|css|woff)$/,
// handler: "CacheFirst",
// options: {
// cacheName: CACHE_ID + "-dependent-cache",
// expiration: { maxAgeSeconds: 90 * 60 * 60 * 24 }
// },
// },
// { urlPattern: /.+\.(png|gif|jpg|jpeg|svg|ico)$/,
// handler: "CacheFirst",
// options: {
// cacheName: CACHE_ID + "-image-cache",
// expiration: { maxAgeSeconds: 30 * 60 * 60 * 24, purgeOnQuotaError: true }
// },
// },
// ]
// });
// const assignedIndex = config.plugins.findIndex(p => p instanceof WorkboxWebpackPlugin.GenerateSW);
// console.debug('Replace WorkboxWebpackPlugin.GenerateSW instance.');
// config.plugins[assignedIndex] = alterWorkboxWebpackPlugin;
// }
config.externals = (config.externals || []).concat([
"bufferutil",
"utf-8-validate"
])
console.debug('Rewired!');
return config;
};