-
Notifications
You must be signed in to change notification settings - Fork 1
/
aunty.config.js
44 lines (40 loc) · 1.16 KB
/
aunty.config.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
module.exports = {
type: 'basic',
build: {
useCSSModules: false
},
babel: config => {
// Compile nanohtml tagged template literals
config.plugins.push([
require.resolve('nanohtml'),
{
useImport: true
}
]);
return config;
},
webpack: config => {
// Enable lazy style injection (https://webpack.js.org/loaders/style-loader/#lazystyletag)
const lazyStyleTest = /\.lazy\.(css|scss)$/;
const stylesRule = config.module.rules.find(rule => rule.__hint__ === 'styles');
const lazyStylesRule = JSON.parse(JSON.stringify(stylesRule));
stylesRule.exclude = lazyStyleTest;
lazyStylesRule.test = lazyStyleTest;
lazyStylesRule.use[0].options = { injectType: 'lazyStyleTag' };
config.module.rules.splice(config.module.rules.indexOf(stylesRule), 0, lazyStylesRule);
// Stop `import()`-ed chunks from being split into `[name].js` and `vendors~[name].js`
config.optimization = {
...(config.optimization || {}),
splitChunks: {
cacheGroups: {
defaultVendors: false
}
}
};
return config;
},
serve: {
hasBundleAnalysis: true,
hot: false
}
};