webpack 合并的时候怎么不处理第三方js,例如jquery
app.js
module.exports = {
get:function(){
return 'max'
}
}
main.js
var app =require('./app.js');
var J=require('./jquery-latest.js');
J('p').text(app.get()) ;
webpack.config.js
module.exports = {
entry: "./main.js",
output: {
path: __dirname,
filename: "bundle.js"
}
};
请问我不想合并jquery,我怎么过滤掉jquery,合并它
mlgb阿根廷
9 years, 12 months ago
Answers
用官方插件
webpack.IgnorePlugin
把不想
bundle
的文件排除掉就好。Example:
javascript
var webpack = require('webpack'); var ignoreFiles = new webpack.IgnorePlugin(/\.\/jquery-last.js$/); module.exports = { entry: './main', output: { path: __dirname, filename: 'bundle.js' }, plugins: [ignoreFiles] }
参考: IgnorePlugin
AS001
answered 9 years, 12 months ago