我一直在角度应用中使用devextreme,但同时使prod build的尺寸更大。因此,我想使用ngx-build-plus和webpack ignore插件将其从产品构建中排除,但不能排除。
我尝试将ngx-build-plus与webpack.extras.js一起使用,但并不排除这种情况。
module.exports = {
"externals": {
"rxjs": "rxjs",
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser",
"devextreme" : "devextreme",
"devexpress-diagram": "devexpress-diagram",
"devextreme-schematics": "devextreme-schematics",
"devextreme-angular": "devextreme-angular",
}
}
我尝试使用webpackignore插件将其排除,我看到错误与api方案不匹配。
发生未处理的异常:无效的配置对象。已使用与API模式不匹配的配置对象初始化Webpack。 -configuration.externals ['plugins'] [0]应该是字符串。
module.exports = {
"externals": {
"rxjs": "rxjs",
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser",
"plugins":[
new webpack.IgnorePlugin(/devextreme/)
]
}
}
它应从prod
构建中排除devextreme。请让我知道是否有解决方案。
答案 0 :(得分:0)
您将plugins
配置对象放置在externals
配置对象中。应该是:
module.exports = {
"externals": {
"rxjs": "rxjs",
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser"
},
"plugins":[
new webpack.IgnorePlugin(/devextreme/)
]
}