vue-cli配置

157 阅读1分钟
function MyPlugin(options) {
    this.options = options;
}

MyPlugin.prototype.apply = function (compiler) {
    var paths = this.options.paths;
    compiler.plugin('compilation', function (compilation, options) {
        compilation.plugin('html-webpack-plugin-before-html-processing', function (htmlPluginData, callback) {
            for (var i = paths.length - 1; i >= 0; i--) {
                htmlPluginData.assets.js.unshift(paths[i]);
            }
            callback(null, htmlPluginData);
        });
    });
};

module.exports = MyPlugin;
new MyPlugin({
  paths: ["http://rap2api.taobao.org/app/plugin/:repositories"]
})