-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.js
31 lines (31 loc) · 943 Bytes
/
plugin.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
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
apply(){
// Process hooks here
cogear.on('webpack.config',(webpackConfig)=>{
webpackConfig.resolve.extensions.push('.vue');
webpackConfig.module.rules.forEach(rule=>{
if(Array.isArray(rule.use) && rule.use.indexOf('style-loader')){
rule.use[rule.use.indexOf('style-loader')] = require.resolve('vue-style-loader');
}
});
webpackConfig.module.rules.push({
test: /\.vue$/,
loader: require.resolve('vue-loader'),
options: {
extractCSS: cogear.mode !== 'development',
}
});
webpackConfig.module.rules.push({
test: /\.pug$/,
oneOf: [
{
resourceQuery: /^\?vue/,
use: [require.resolve('pug-plain-loader')]
},
]
});
webpackConfig.plugins.push(new VueLoaderPlugin());
});
}
};