Reputation: 9
I have been using devextreme in angular application, but while making prod build its taking more size. So, I wanted to exclude it from prod build using ngx-build-plus and webpack ignore plugin but its not excluding.
I tried with ngx-build-plus with webpack.extras.js, it does not exclude.
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",
}
}
I tried with webpack ignore plugin to exclude it, I see error not matching api scheme.
An unhandled exception occurred: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.externals['plugins'][0] should be a string.
module.exports = {
"externals": {
"rxjs": "rxjs",
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser",
"plugins":[
new webpack.IgnorePlugin(/devextreme/)
]
}
}
It should exclude devextreme from the prod
build. Please let me know if any solutions.
Upvotes: 0
Views: 340
Reputation: 2253
You placed your plugins
configuration object inside your externals
configuration object. It should be:
module.exports = {
"externals": {
"rxjs": "rxjs",
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser"
},
"plugins":[
new webpack.IgnorePlugin(/devextreme/)
]
}
Upvotes: 0