In previous versions of Angular there was an option for eject so that you could modify your webpack configuration as you please.
One of the most common use cases for thi
For Angular 8 @angular-builders/dev-server:generic
has been deprecated and @angular-builders/custom-webpack:dev-server
is being used instead, source: https://github.com/just-jeb/angular-builders/blob/master/MIGRATION.MD.
On top of this you might need to run npm i @angular-devkit/architect@latest @angular-devkit/build-angular@latest @angular-devkit/core@latest @angular-devkit/schematics@latest
if after migrating you would have seen the following error architect_1.createBuilder is not a function
.
Disclaimer: I am the owner of the below library
You can use angular-builders library that allows you extending the existing browser
and server
targets with a custom webpack config.
The usage is pretty simple:
npm i -D @angular-builders/custom-webpack
Modify your angular.json:
"architect": {
...
"build": {
"builder": "@angular-builders/custom-webpack:browser"
"options": {
"customWebpackConfig": {
"path": "./extra-webpack.config.js",
"replaceDuplicatePlugins": true
},
"outputPath": "dist/my-cool-library",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json"
...
}
Here you can find an example that adds node-loader
to browser config.
Further reading:
Customizing Angular CLI build - an alternative to ng eject