-
Notifications
You must be signed in to change notification settings - Fork 536
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
refactor(project): remove theme-preval.js #3243
Conversation
|
size-limit report 📦
|
cc @colebemis would love your feedback here! 👀 |
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.
Since we're not using polished
, I think removing theme-preval.js
is a good idea 👍 This will make all our lives a lot easier. No more cache issues! 🎉
This reverts commit 8733988.
The
theme-preval.js
file is used alongsidebabel-plugin-preval
to generate an object containing all the tokens and values from@primer/primitives
. For an example of its output, see: https://unpkg.com/browse/@primer/react@35.25.1/lib-esm/theme-preval.jsThis approach introduces some limitations, namely that:
babel
and makes it difficult to switch to alternative bundlers (like TypeScript, esbuild, swc, etc)The experiment here looks into removing our dependency on preval so that:
babel-plugin-preval
along with transforms we use for mapping the emitted CommonJS to ESMFrom a user perspective, this change should not be noticeable. Even though
@primer/primitives
is currently emitting CommonJS, the size difference should be minimal as we were including the package contents in the emittedtheme-preval.js
file