vue-webpack-plugin
Version:
一个处理vue框架的webpack插件
37 lines (36 loc) • 1.07 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugin_1 = __importDefault(require("vue-loader/lib/plugin"));
/**
* 处理vue项目的插件
*/
class VueWebpackPlugin {
/**
* vue-loader配置项 详见:https://vue-loader.vuejs.org/zh/options.html
* @param options vue-loader配置项
*/
constructor(options = {}) {
this.options = {};
this.options = options;
}
/**
* 执行插件
* @param compiler
*/
apply(compiler) {
const { resolve, plugins, module } = compiler.options;
resolve.extensions.push('.vue');
module.rules.push({
test: /\.vue$/,
loader: 'vue-loader',
options: this.options
});
plugins.push(new plugin_1.default());
}
}
exports.VueWebpackPlugin = VueWebpackPlugin;
exports.default = VueWebpackPlugin;
module.exports = VueWebpackPlugin;