-
-
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
Question: Can babel-plugin-transform-runtime 's moduleName be removed? #1893
Comments
See #255, temporary fix #262 and permanent fix #535. Node's resolution algorithm does not recursively search to any depth and strictly checks parent directories. If you can show that it's no longer necessary, we can consider removing it. Just make sure it still works on NPM 2.x (Node 4). May I ask why this is a problem for you? This should be compiled away when generating a production build. |
Ah that makes sense. Just tested and looks like it is still required for Node 4, I'll close the ticket since the question's answered :)
|
I'm misusing the preset for a node app :p - building via babel's directory compilation, and used react-apps' babel presets out of laziness. Was tripped up a bit by the absolute path when I deployed the transpiled js and saw it was trying to require regenerator from a path on the computer where it was transpiled |
That's not misuse! We encourage it. |
moduleName: path.dirname(require.resolve('babel-runtime/package'))
This results in the full absolute path to be injected into the transpiled result, so you see
instead of
As a workaround, I overwrote the plugin options by adding this to the end of my own babelrc's plugins array
I'm curious what problem the full path solved, and whether it's possible to solve that problem a different way? Tracing back the file history only lead me to the commit for the monorepo migration
Feel free to close the issue, I wasn't sure where else to ask this question
The text was updated successfully, but these errors were encountered: