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

Difference between ng build and npm run build #13560

Closed
mdufoud1214 opened this issue Jan 31, 2019 · 4 comments
Closed

Difference between ng build and npm run build #13560

mdufoud1214 opened this issue Jan 31, 2019 · 4 comments

Comments

@mdufoud1214
Copy link

@mdufoud1214 mdufoud1214 commented Jan 31, 2019

am using angular 7 and server side using .net core 2.1
if i do npm run build --prod --aot my dist folder size is around 40mb and my application working as expected,
but if i do ng build --prod --aot my dist folder size is reducing to around 9mb but am not able to run applications some map files are missing getting 404 error(find below screenshot)

i want reduce my bundle size to improve my angular app performance

image

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jan 31, 2019

You need to use —- to pass arguments to npm scripts.
npm run build —- —-prod

@mdufoud1214
Copy link
Author

@mdufoud1214 mdufoud1214 commented Feb 4, 2019

@alan-agius4 npm run build —- —-prod it is working as expected , it is reducing dist folder size and application is running ,but where to add this in package.json file

"build-watch": "../@angular/cli/bin/ng build --deploy-url=dist/ --output-hashing all --watch",

@rakotomandimby
Copy link

@rakotomandimby rakotomandimby commented Apr 30, 2019

Hi, I faced the same issue when having to specify the "base-href" parameter, and the double dash was the solution!
https://mihamina.rktmb.org/2019/04/npm-run-build-base-href.html

@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Sep 9, 2019

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants