-
Notifications
You must be signed in to change notification settings - Fork 647
refactor(project): remove theme-preval.js #3243
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
Conversation
|
size-limit report 📦
|
|
cc @colebemis would love your feedback here! 👀 |
colebemis
left a comment
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.jsfile is used alongsidebabel-plugin-prevalto generate an object containing all the tokens and values from@primer/primitives. For an example of its output, see: https://unpkg.com/browse/@primer/[email protected]/lib-esm/theme-preval.jsThis approach introduces some limitations, namely that:
babeland 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-prevalalong with transforms we use for mapping the emitted CommonJS to ESMFrom a user perspective, this change should not be noticeable. Even though
@primer/primitivesis currently emitting CommonJS, the size difference should be minimal as we were including the package contents in the emittedtheme-preval.jsfile