基于easywebpack
扩展easywebpack-vue
实现
GitHub: https://github.com/hubcarl/easywebpack-vue
公共配置
'use strict';
const EasyWebpack = require('easywebpack');
const WebpackBaseBuilder = WebpackBuilder => class extends WebpackBuilder {
constructor(config) {
super(config);
this.setExtensions('.vue');
}
};
module.exports = WebpackBaseBuilder;
浏览器(Browser)模式配置
'use strict';
const EasyWebpack = require('easywebpack');
const WebpackBaseBuilder = require('./base');
class WebpackClientBuilder extends WebpackBaseBuilder(EasyWebpack.WebpackClientBuilder) {
constructor(config) {
super(config);
this.setAlias('vue', 'vue/dist/vue.common.js', false);
}
}
module.exports = WebpackClientBuilder;
服务端(Node)配置
'use strict';
const EasyWebpack = require('easywebpack');
const webpack = EasyWebpack.webpack;
const WebpackBaseBuilder = require('./base');
class WebpackServerBuilder extends WebpackBaseBuilder(EasyWebpack.WebpackServerBuilder) {
constructor(config) {
super(config);
this.setAlias('vue', 'vue/dist/vue.runtime.common.js', false);
}
}
module.exports = WebpackServerBuilder;