-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathindex.js
35 lines (29 loc) · 885 Bytes
/
index.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
const { VueLoaderPlugin } = require('vue-loader')
exports.babel = function (config) {
config.plugins = (config.plugins || []).concat([
[require.resolve('@babel/plugin-proposal-decorators'), { legacy:true }],
require.resolve('@babel/plugin-proposal-object-rest-spread'),
require.resolve('@babel/plugin-proposal-class-properties')
]);
}
exports.webpack = function (config, opts) {
config.resolve.extensions.push('.vue');
Object.assign(config.resolve.alias, {
'vue$': 'vue/dist/vue.esm.js'
});
// replace "style-loader" w/ "vue-style-loader"
config.module.rules.forEach(obj => {
if (Array.isArray(obj.use)) {
obj.use = obj.use.map(x => x === 'style-loader' ? 'vue-style-loader' : x);
}
});
config.module.rules.unshift({
test: /\.vue$/,
loader: 'vue-loader'
});
config.plugins.push(
new VueLoaderPlugin({
productionMode: opts.production
})
);
}