Within ngx-build-plus, how can I determine build configuration?

504 views Asked by At

Using ngx-build-plus, and within a custom plugin, how can I determine what build configuration was requested from the angular cli build command-line?

If you are wondering how I'll use this, here is the use case: I'm trying to rename the main.ts file before compiling my project based on the build configuration I choose --> Normal build vs. a Cordova build. The Cordova build requires a different setup for main.ts and wrapping platformBrowserDynamic().bootstrapModule(AppModule); within if statements doesn't work for web so I have no option but to use 2 different main.ts files I will switch out based on build type.

1

There are 1 answers

0
Post Impatica On

Not the best answer but here is a simple solution. I don't need to determine build configuration because I can simply choose different custom plugins within the command line.

Example

When building for Cordova:

ng build --plugin ~webpack.cordova.js 

Normal Build:

ng build --plugin ~webpack.extra.js