Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get it to build with --env=dev #7

Closed
enhendrickson opened this issue Sep 6, 2018 · 6 comments
Closed

I can't get it to build with --env=dev #7

enhendrickson opened this issue Sep 6, 2018 · 6 comments
Labels

Comments

@enhendrickson
Copy link

I apologize for being a squeaky wheel but I have run the following commands and I can't get the angular side of my app to build in development environment. It's always prod config.

npm run cordova:build -- --env=dev --device --debug
npm run cordova build --device --debug -- --env=dev
npm run cordova build --device --debug --env=dev

In several of the version of the above, I saw something complaining that
Unknown option: '--env'

What am I doing wrong?

@sinedied
Copy link
Member

sinedied commented Sep 6, 2018

No need to apologize, thanks to you I just discovered that they replaced --env by --configuration, among other breaking changes in angular-cli 6 that were not documented 😞

So I need to change the flag in ngx-script too, I'll push a fix ASAP

@enhendrickson
Copy link
Author

Oh, okay... I wondered if that was it... thanks. When you push, would I need to pull from Github or will an npm update grab it?

@sinedied sinedied added the bug label Sep 7, 2018
@sinedied
Copy link
Member

sinedied commented Sep 7, 2018

I just published version 3.0.0 to NPM, so you just have to npm i ngx-scripts@latest in your project 😉
Had to make it a major version bump since I changed the --env option to --configuration to match angular/cli new behavior.

@sinedied sinedied closed this as completed Sep 7, 2018
sinedied added a commit to ngx-rocket/generator-ngx-rocket that referenced this issue Sep 7, 2018
Also added mention of CLI features in the readme, following ngx-rocket/scripts#6
@enhendrickson
Copy link
Author

This should work, right?
ngx-scripts cordova build --device --debug -- --configuration=dev

It doesn't. It still uses production.

@sinedied
Copy link
Member

@enhendrickson Angular CLI changed the way it works, the --configuration flag does not behave the same as the previous --environment flag: it now selects a whole build configuration defined in angular.json, not just the environment file.
And by default you have one for production, but not for dev, so you have 2 options here:

  • use the --dev flag of ngx-scripts that bascially set the --prod=false flag on Angular CLI, ie: ngx-scripts cordova build --dev --device --debug, but it will also disable minifications and code optiomization beside changing the environment

  • create a new dev configuration in angular.json that extends the existing production one but with a different enviromnent file, and then your command will work.

Yes, that's a lot of bother for something that just used to work 😞

@enhendrickson
Copy link
Author

@sinedied thanks for the awesome explanation!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants