-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
简化 webpack plugins 配置 #3921
Comments
webpack plugin 添加 / 修改{
"webpackPlugins": {
"${pluginPackagename}": { // webpack 插件包名,内部直接以 require 的方式使用
"options": {
"pluginOption": true
},
"before": "html-plugin"
},
"webpack.ProvidePlugin": { // webpack 内置插件,符合 webpack.xxx 开头规则
"options": {
"pluginOption": true
}
}
}
}
webpack loader 添加{
"webpackLoaders": {
"${ruleName}": { // rule 名称存在则替换内容,不存在的情况下新建 loader 规则
"test": "node_module",
"loaders": {
"${loaderPackagename}": { // 当前规则下存在对应名称,则直接修改配置,否则新增配置
"options": {
"loaderoption": true
},
"before": "less-loader"
}
}
}
}
} |
添加和修改能不能统一到一个字段? |
统一成 webpackPlugins 和 webpackLoaders,用规则名是否存在来决定是新增设置还是修改参数 |
怎么删除某个 plugin 或者 loader ? |
目前需求上集中在新增和修改,删除的场景比较少 |
修改是 merge 吧,那是简单了很多。除非要完全覆盖一个 plugin / loader 。需要先删除后新增。 |
关联 issue ice-lab/build-scripts#2
比如 build.json 里可以直接配置 webpackPlugins、webpackLoaders 之类的参数,参考 nuxtjs https://nuxtjs.org/faq/webpack-plugins
The text was updated successfully, but these errors were encountered: