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

In lib/assets/package.json, why is webpack in devDependencies? #1763

Closed
Yu-Chieh-Henry-Yang opened this issue Aug 1, 2018 · 1 comment
Closed

Comments

@Yu-Chieh-Henry-Yang
Copy link

Yu-Chieh-Henry-Yang commented Aug 1, 2018

I expect webpack to be in dependencies not devDependencies, because if it's in devDependencies, then it won't be used in production.

But if I don't have webpack in production, I cannot serve the asset, and our app won't work properly.

Why is webpack in devDependencies?

Also, do people simply use npm run bundle -- -p to run webpack in production? How do they handle asset file change? Do they need to stop webpack and re-run npm run bundle -- -p? Do they have to manually login to server, find the pid of webpack by using ps and use kill -9 to kill it?

@Bodacious
Copy link
Contributor

@Yu-Chieh-Henry-Yang

On the production server, asset files should not change. They only need to be compiled once, during deployment. Therefore, you do not need to have a webpack process running on the server.

Webpack should only need to be run once, during deploy. This will create the static asset files in the public directory, which should then be served by your server software (likely NGINX or Apache).

The question of whether to put webpack in devDependencies or dependencies is therefore mostly academic, and shouldn't have any significant impact on your project.

See this thread for further discussion: webpack/webpack#520

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

No branches or pull requests

2 participants