mardi 16 avril 2019

How to publish multiple compiled versions of a JS library on npm

I'm writing a React library, and I want to be able to consume pieces of it individually in different apps. What I'm doing now is publishing the es6 versions of my files (with TS definitions) and when building the app, I compile the library into only the pieces I need.

This works great, except when I need to test UI components that use the library. If they're using different versions of libraries, Babel for instance, the compilation of those es6 files to something Jest can read fails.

I know how to bundle the library into a single bundle, but how can I write the configuration for Jest so that it knows to use the single (much larger) bundle, rather than passing those files through ts-jest, which is what I'm doing now.

Aucun commentaire:

Enregistrer un commentaire