-
Notifications
You must be signed in to change notification settings - Fork 567
/
vue.config.js
49 lines (47 loc) · 1.57 KB
/
vue.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
45
46
47
48
49
function FancyIndexPlugin(options) {
}
FancyIndexPlugin.prototype.apply = function (compiler) {
compiler.plugin('emit', function (compilation, callback) {
for (let filename in compilation.assets) {
if (filename === 'index.html') {
const file = compilation.assets[filename];
const html = file.source();
const splitted = html.split('/</h1>');
const header = splitted[0];
const footer = splitted[1];
compilation.assets[`${process.env.ASSETS_DIR}/header.html`] = {
source: function () {
return header;
},
size: function () {
return header.length;
}
};
compilation.assets[`${process.env.ASSETS_DIR}/footer.html`] = {
source: function () {
return footer;
},
size: function () {
return footer.length;
}
};
}
}
callback();
});
};
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production',
productionSourceMap: false,
css: {
extract: true
},
baseUrl: process.env.BASE_URL,
assetsDir: process.env.ASSETS_DIR,
chainWebpack: config => {
if (process.env.USE_FANCY_INDEX) {
config.plugin('fancy-index-plugin').use(FancyIndexPlugin);
}
config.optimization.splitChunks({});
}
};