-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
61 lines (59 loc) · 1.5 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
50
51
52
53
54
55
56
57
58
59
60
61
const webpack = require('webpack');
const path = require('path');
const pkg = require('./package.json');
module.exports = {
css: {
loaderOptions: {
css: {
// localIdentName: `${pkg.libname}[name]_[local]_[hash:base64:5]`,
},
},
},
lintOnSave: false,
configureWebpack: () => {
const customConfig = {
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.jquery': 'jquery',
'window.jQuery': 'jquery',
'window.$': 'jquery',
}),
new webpack.DefinePlugin({
LIBNAME: JSON.stringify(pkg.libname),
}),
],
};
// config for lib
if (process.env.VUE_CLI_BUILD_TARGET === 'lib') {
// set external modules so they won't get bundled with the lib
customConfig.externals = [
'bootbox',
'bootstrap',
'font-awesome',
'jquery',
'vue',
];
}
// config parameter can be mutated
// or a new object (to be used with webpack-merge) returned
return customConfig;
},
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'test') {
config.module
.rule('istanbul')
.test(/\.(js|vue)$/)
.enforce('post')
.include
.add(path.resolve(__dirname, '/src'))
.end()
.use('istanbul-instrumenter-loader')
.loader('istanbul-instrumenter-loader')
.options({ esModules: true })
.end();
}
},
};