Fix: Move build dependencies to allow npm install --omit=dev#408
Fix: Move build dependencies to allow npm install --omit=dev#408bob10042 wants to merge 1 commit intothoughtworks:masterfrom
Conversation
Moves build-related dependencies (webpack, babel, sass, etc.) from devDependencies to dependencies so that 'npm run build:prod' works after 'npm install --omit=dev'. This is useful for CI/CD pipelines and deployments behind corporate firewalls where installing test dependencies like Cypress (which is very large) causes timeouts. devDependencies now only contains: - Testing: jest, cypress, jsdom, mochawesome - Linting: eslint, prettier Fixes thoughtworks#283
There was a problem hiding this comment.
Pull request overview
This PR moves build-time dependencies from devDependencies to dependencies to enable running npm install --omit=dev && npm run build:prod successfully. This addresses a use case where DevOps teams behind corporate firewalls want to avoid installing large test dependencies like Cypress.
Changes:
- Moved webpack, babel, and CSS/SASS processing packages from devDependencies to dependencies
- Reorganized package.json to support production builds without devDependencies
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "style-loader": "^3.3.3", | ||
| "webpack": "^5.89.0", | ||
| "webpack-cli": "^5.1.4", | ||
| "webpack-dev-server": "^5.2.2", |
There was a problem hiding this comment.
The webpack-dev-server package should not be moved to dependencies. It is only used by the "dev" script (line 9 in package.json), which runs a development server, not by the production build script. The production build only uses the "webpack" and "webpack-cli" packages. This package should remain in devDependencies to avoid unnecessarily increasing the size of production dependencies.
| "dependencies": { | ||
| "@babel/core": "^7.23.2", | ||
| "@babel/preset-env": "^7.23.2", | ||
| "babel-loader": "^9.1.3", | ||
| "chance": "^1.1.11", | ||
| "css-loader": "^6.8.1", | ||
| "cssnano": "^6.0.1", | ||
| "d3": "^7.8.5", | ||
| "d3-tip": "^0.9.1", | ||
| "dotenv": "^16.3.1", | ||
| "expose-loader": "^4.1.0", | ||
| "html-webpack-plugin": "^5.5.3", | ||
| "jquery": "^3.7.1", | ||
| "jquery-ui": "^1.13.2", | ||
| "lodash": "^4.17.21", | ||
| "mini-css-extract-plugin": "^2.7.6", | ||
| "postcss-loader": "^7.3.3", | ||
| "postcss-preset-env": "^9.2.0", | ||
| "prettier": "^3.0.3", | ||
| "sanitize-html": "^2.11.0", | ||
| "sass": "^1.69.3", | ||
| "sass-loader": "^13.3.2", | ||
| "style-loader": "^3.3.3", | ||
| "webpack": "^5.89.0", | ||
| "webpack-cli": "^5.1.4", | ||
| "webpack-dev-server": "^5.2.2", | ||
| "webpack-merge": "^5.10.0", | ||
| "yargs": "^17.7.2" | ||
| }, |
There was a problem hiding this comment.
The PR description mentions moving "@babel/plugin-transform-object-assign" and "copy-webpack-plugin" to dependencies, but these packages don't appear in the actual changes or anywhere in the codebase. The PR description should be updated to accurately reflect only the packages that were actually moved.
Issue
Fixes #283
Problem
Running
pm install --omit=dev && npm run build:prod\ fails because webpack, babel, and sass-related packages are in devDependencies but are required for the production build.
Solution
Moved the following build-time dependencies from \devDependencies\ to \dependencies:
Testing
Verified that
pm install --omit=dev && npm run build:prod\ completes successfully.
Notes
This is a common pattern when the build step runs in a production environment where devDependencies are not installed for security/size reasons.