You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When consuming a single @primer/components component, the entire set of components is included in the build (even when using lib-esm), since the package.json does not declare the package as free of sideEffects via sideEffects: false or sideEffects: ['file 1', 'file 2']
Deep importing like
import {Button} from '@primer/components/lib-esm/components/Button' seems to work properly, however if any import to import {} from '@primer/components' is made, then eveything exported from @primer/components is included in the build
To Reproduce
Steps to reproduce the behavior:
Open a new project
Add @primer/components as a dependency
Import a single component like import {Button} from '@primer/components'
Generate and analyze a bundle, note that all components are included in bundle
Expected behavior
Only the used components are included in the build
Screenshots
My project, bundled with webpack 4 emits a bundle containing this:
Which includes components like etc which are not used in my project.
Updating the node_modules package.json for @primer/components to include sideEffects: false and rebuilding with the same command leads to a bundle containg this
Which removes unused components from my project, leading to a large reduction in bundle size
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
When consuming a single
@primer/components
component, the entire set of components is included in the build (even when using lib-esm), since the package.json does not declare the package as free ofsideEffects
viasideEffects: false
orsideEffects: ['file 1', 'file 2']
Deep importing like
import {Button} from '@primer/components/lib-esm/components/Button'
seems to work properly, however if any import toimport {} from '@primer/components'
is made, then eveything exported from@primer/components
is included in the buildTo Reproduce
Steps to reproduce the behavior:
@primer/components
as a dependencyimport {Button} from '@primer/components'
Expected behavior
Only the used components are included in the build
Screenshots
My project, bundled with webpack 4 emits a bundle containing this:
Which includes components like etc which are not used in my project.
Updating the node_modules package.json for
@primer/components
to includesideEffects: false
and rebuilding with the same command leads to a bundle containg thisWhich removes unused components from my project, leading to a large reduction in bundle size
Desktop (please complete the following information):
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: