Reputation: 1199
I have a library written in ES6/JSX and want to install it using npm install
on a create-react-app
application. How can I force babel to parse this lib from node_modules
?
Something like not ignore node_modules/my-library
when transpiling.
Upvotes: 1
Views: 293
Reputation: 4080
I think your library shouldn't rely on third applications dependencies,
then it won't be useful and it will only work on projects that contain Babel
as a depency.
Instead, You should add Babel
to your library dependencies, and create a build of your library using babel
to transpile your ES6
code to ES5
code which will result in standard javascript.
Therefore, you can easily add it to any project by importing the build.
Upvotes: 1