You are creating a build for a production environment and realize that some of the devDependencies are being included in the build, causing it to be bulkier. What steps would you take to rectify this?
- Manually remove devDependencies from package.json
- Use Webpack to exclude devDependencies
- Use the npm prune --production command
- Upgrade all devDependencies to their latest versions
To rectify this issue, you should use the npm prune --production command. This command removes unnecessary devDependencies from your node_modules directory, ensuring that only production dependencies are included in the build. Options (1) and (4) are not recommended because manually removing or upgrading devDependencies can be error-prone. Option (2) doesn't directly address the issue, and Webpack is typically used for bundling rather than dependency management.
Loading...
Related Quiz
- What is the first line of defense against injection attacks in web applications?
- What does a 0 as the major version (e.g. 0.1.2) signify in semantic versioning?
- Which of the following is a primary feature of a testing framework like Mocha or Jest?
- Which of the following is a purpose of using authentication strategies in web development?
- How does JavaScript handle circular dependencies between modules?