I have installed brotli-webpack-plugin
as a devDependency
. While trying to create production build using npm run build
(internally it calls next build
), it throws following error
Error: Cannot find module 'brotli-webpack-plugin'.
I am using this plugin inside next.config.js
.
During my production build, I want to do npm install --production
to reduce the container size. What should I do ?
If i use npm istall
only, then the build is being created without any error. Should I move that package from devDependency
to dependency
?
I'm guessing you want to do this:
And you want to add only the production dependencies. The module that throws you the error is needed in build phase and if you install only production dependencies the build won't succeed. Assuming you are using a terminal or anything with bash do something like this:
Should work for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.