TypeScript - Babel loader required for transpiling new ES syntax
mengX666 opened this issue · 0 comments
Hey we'd like to use some of the functionalities in this library to generate color ramps in another npm package @atlaskit/tokens
https://www.npmjs.com/package/@atlaskit/tokens.
We found out the compiled dependency has some ES20 syntaxes ?.
and ??
which need to be transpiled with Babel plugins. It also means all the consumers of our package @atlaskit/tokens
will need to transpile if their bundlers don't handle these syntaxes.
A workaround might be - the functions we are importing don't use these new ES syntaxes, so subpath import could work e.g. import { Hct } from "@material/material-color-utilities/hct";
and it requires an update in the exports
field in package.json
.
Another solution might be compiling the library with an older Babel plugin so that neither we nor our consumer has to transpile, but it might increase the bundle size.
Would love to hear your thoughts on this, thanks 🙏