Uh oh!
There was an error while loading. Please reload this page.
refactor(project): remove theme-preval.js - #3243
Conversation
|
size-limit report 📦
|
joshblack
commented
May 4, 2023
cc @colebemis would love your feedback here! 👀 |
colebemis
left a comment
There was a problem hiding this comment.
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/react@35.25.1/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