Proposal: Remove Dev Dependencies from Production Bundle
Background
Our production application currently consists of 44 bundles containing 4,187 modules. Analysis reveals that 5 development dependencies are inadvertently being included in production bundles that are served to users.
Problem
When our build process runs, if development dependencies get included in production bundles, then users download unnecessary code that increases load times and wastes bandwidth.
Solution
Remove the 5 development dependencies from production bundles by:
implementing MiniCssExtractPlugin for CSS handling
configuring IgnorePlugin to exclude modules only used in development
cleaning up package.json dependency classifications
setting up the proper version of React compiler for production builds
This will reduce our bundle count from 44 to 43, decrease total modules from 4,187 to 4,128, and reduce bundle size by 120kb. The following libraries will no longer be reported in production bundles:
- css-loader
- style-loader
- react-is
- react-compiler-runtime
- @babel/runtime (moved from dev to normal dependencies to align with official documentation)
This results in slightly faster load times and reduced bandwidth costs.
Issue Owner
Current Issue Owner: @RachCHopkins
Proposal: Remove Dev Dependencies from Production Bundle
Background
Our production application currently consists of 44 bundles containing 4,187 modules. Analysis reveals that 5 development dependencies are inadvertently being included in production bundles that are served to users.
Problem
When our build process runs, if development dependencies get included in production bundles, then users download unnecessary code that increases load times and wastes bandwidth.
Solution
Remove the 5 development dependencies from production bundles by:
implementing MiniCssExtractPlugin for CSS handling
configuring IgnorePlugin to exclude modules only used in development
cleaning up package.json dependency classifications
setting up the proper version of React compiler for production builds
This will reduce our bundle count from 44 to 43, decrease total modules from 4,187 to 4,128, and reduce bundle size by 120kb. The following libraries will no longer be reported in production bundles:
This results in slightly faster load times and reduced bandwidth costs.
Issue Owner
Current Issue Owner: @RachCHopkins