2

I use ngx-build-plus to include a special webpack loader to integrate special custom files into our Angular-CLI build process (Angular 10).

Everything works fine, however I couldn't find a way to use e2e-tests this way, it's not even taking the --extra-webpack-config option...

$ ng e2e --extra-webpack-config webpack.partial.js
Unknown option: '--extra-webpack-config'
Unknown option: 'webpack.partial.js'

How could I fix the e2e tests to use the webpack.partial.js ?

hoeni
  • 3,031
  • 30
  • 45

2 Answers2

1

After many things I've tried I couldn't find out how to get it to work with ngx-build-plus at all. However, I found out there is a different module @angular-builders/custom-webpack which provides exact the functionality of seamlessly extending an Angular-CLI webpack configuration and worked perfectly with my e2e-tests. There is no need to pass arguments to the build process, as the name of the webpack.conf fragment s configured in the angular.json config file:

"customWebpackConfig": {
    "path": "./webpack.config.js"
}
hoeni
  • 3,031
  • 30
  • 45
  • here's how to install the angular-builders: https://stackoverflow.com/a/51130803/4255158 – Tony Mar 07 '21 at 09:32
-1

Might be a little late here, but you need to change your builder in the angular.json file

Replace:

"builder": "angular-cli-builders:custom-webpack-browser"

With

"builder": "ngx-build-plus:browser"

This was not mentioned in the documentation so i had to do some digging in their sample projects. Works like a charm

Successful Build

Nathan
  • 342
  • 2
  • 11
  • 1
    The normal build was never a problem. The question is: How to get the e2e run to pass the correct options like the extra webpack config to the e2e build – hoeni Sep 14 '20 at 08:36