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 · 3 comments

Comments

Projects
None yet
3 participants
@mdufoud1214
Copy link

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

This comment has been minimized.

Copy link
Collaborator

commented Jan 31, 2019

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

@mdufoud1214

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.