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.
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.
babel src --out-dir dist command will only do the work for js files.
package.jsonfile, some.jsx, some.cssand some.pngfiles and use it as a git submodule inside my applicationsrcpath. I want to refer to this lib directly fromnode_modulesso that I can import from "my-library", not from "../../my-library" and have it installed when someone typesnpm installwithout the pain of remembering the "--recursive" on git.