-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using ES6-authored modules with CRA #3889
Comments
I think is not quite correct to use I understand the guidelines are fuzzy on this, but in general I suggest you to limit the difference between
Yes, but to a limit. Our 2.x alpha versions do compile Note we’re also working to improve the workflow for multiple components in a single repository. You might want to track #1333 and #3741 for this. The target is also to implement this in 2.x. Hope this helps! |
Ran into this same issue while working on my own specialized alternative to |
That’s pretty fragile and we definitely recommend against doing this. I can’t stop you of course. But this will break in patch releases easily. |
@gaearon thanks for the fair warning! It's still very early days for my library, so I'm OK with updating it for future |
Thanks @gaearon — I’ll definately try react 2. Babel 7 is meant to resolve the extending of native classes restriction, which would fix my original problem. To be clear, the ES6 code in node_modules is fine without transpiling for my project. I didn’t even realize the u transpiled code was what was being used until I needed to subclass something. |
I'm working on a project that has a dependency on an npm module written in ES6. The module's package.json includes the following:
It's 'lib' directory contains transpiled ES5 compatible code; the 'src' directory contains the ES6 code 'lib' is derived from. This all worked great until I needed to sub-class a class from this module.
CRA's babel/webpack configuration is picking up the code from 'src/...', due to the
module
entry in the module's package.json, but is not transpiling it. Therefore babel fails to transpile the sub-class, as it doesn't support extending native classes.Solutions/workarounds I've found so far include:
module
entry from package.jsonIs there any other approach to getting this working I haven't found? Could CRA's build system (or babel configuration) be tweaked to automatically include transpilation of modules like this so things would work out of the box? Any other ideas for how this could be improved?
The text was updated successfully, but these errors were encountered: