示例:
webpack.config.js
var getWebpackConfig = function() {
return {
context: __dirname + "/src/scripts",
entry: {
Core: "./Core",
Editor: "./Editor",
},
devtool: "source-map",
externals: [
{
'jquery': {
root: '$',
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery'
}
}
],
output: {
path: path.join(__dirname, "dist/scripts"),
filename: "Time.[name].js",
libraryTarget: "umd",
library: ["Time", "[name]"]
},
module: {
loaders: [
{
test: /\.js$/,
exclude: [/node_modules/, /dist/],
loader: 'babel',
query: {
presets: ['es2015']
}
},
{
test: /\.tpl.html$/,
loader: 'mustache'
}
],
},
plugins: [
]
};
};
在项目 A 中包含Time.Core.js后,将替换lodash的全局变量,版本变为3.10.1
问题:如何在某些模块的组装过程中更改变量,以便在包含项目A时无需使用noConflict()就可以访问它?
谢谢。