The webpack build process hangs indefinitely and never completes when running npm run build:js or npm run build.
Two configuration issues in webpack.config.js:
.css files cause webpack to hangwatch: true hardcoded for development mode prevents build from completingnpm run build:jsBefore: watch: env.production ? false : true,
After: watch: env.watch || false,
Before (two conflicting rules): { test: /.css$/i, use: ["style-loader", "css-loader", "postcss-loader"], }, { test: /.css$/, use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"], },
After (single rule): { test: /.css$/, use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"], }
"scripts": { "build:js": "webpack --mode=development", "build:js:watch": "webpack --mode=development --env watch", ... }
The default build:js command should complete and exit (for CI/CD), with a separate build:js:watch command for development file watching, matching the pattern already used for CSS (build:css vs build:css:watch).
Hi
Thank you for your feedback. We will improve it.
You can use "npm run build:prod" to build without watch mode.
Thanks