-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(styles,carbon-react): switch to cds prefix #9719
feat(styles,carbon-react): switch to cds prefix #9719
Conversation
✔️ Deploy Preview for carbon-react-next ready! 🔨 Explore the source changes: 33b4672 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/614b612055799c00071af7fb 😎 Browse the preview: https://deploy-preview-9719--carbon-react-next.netlify.app |
@@ -92,6 +92,8 @@ | |||
}, | |||
"sideEffects": [ | |||
"es/feature-flags.js", | |||
"lib/feature-flags.js" | |||
"lib/feature-flags.js", | |||
"es/prefix.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why do these files (really all of them) have to be listed as sideEffects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also curious. My guess is since it's pulled from carbon-components
these should never be pruned when tree shaking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abbeyhrt @tay1orjones basically these modules are not "pure" because they cause side effects in other modules (feature flags, components).
Bundlers like webpack/rollup will assume modules are pure by default if sideEffects: false
is listed. This means that if exports from these entrypoints are used that the bundler will actually drop the file from the final output. This is not what we want because we always want these files to be included and their side effects run.
Annotating these files as having side effects ensures that they are included in the final bundle even though we aren't using exports from these files.
Hope this helps!
✔️ Deploy Preview for carbon-components-react ready! 🔨 Explore the source changes: 33b4672 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/614b6120ae9595000755b824 😎 Browse the preview: https://deploy-preview-9719--carbon-components-react.netlify.app |
✔️ Deploy Preview for carbon-elements ready! 🔨 Explore the source changes: 33b4672 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/614b612030ec6f00083bc23a 😎 Browse the preview: https://deploy-preview-9719--carbon-elements.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAY!!! It's working! 🔥
Update our beta packages to use
cds
as the default prefix instead ofbx
. This PR includes two significant changes:$prefix
variable in@carbon/styles
to becds
. It is still configurable underscss/_config.scss
src/prefix.js
file in@carbon/react
that changes the prefix incarbon-components
. This will be removed in v11 and replaced byPrefixContext
Changelog
New
Changed
bx
tocds
for styles and ReactRemoved
Testing / Reviewing