Skip to content
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

Unknown plugin transform-runtime #24

Closed
otiai10 opened this issue Jun 7, 2016 · 7 comments
Closed

Unknown plugin transform-runtime #24

otiai10 opened this issue Jun 7, 2016 · 7 comments

Comments

@otiai10
Copy link

otiai10 commented Jun 7, 2016

Problem As Is

In project of usage side

TransformError: /Users/otiai10/project/foo/node_modules/redux-orm/lib/index.js: Unknown plugin "transform-runtime" specified in "/Users/otiai10/project/foo/node_modules/redux-orm/.babelrc" at 0, attempted to resolve relative to "/Users/otiai10/project/foo/node_modules/redux-orm"

Reason

It's because missing plugins (and presets as well) in node_modules of the project.

Of course it can be solved by hitting following command in the project of usage side.

npm install babel-plugin-transform-runtime babel-preset-es2015 babel-preset-stage-2

Solution To Be

But, it's a bit weird for npm to describe the dependencies of library in the package.json of usage side.
So I think we should put these dependencies in dependencies field of package.json, not in devDependencies. like this

diff --git a/package.json b/package.json
index b0bf608..c788783 100644
--- a/package.json
+++ b/package.json
@@ -21,9 +21,6 @@
     "babel-cli": "^6.8.0",
     "babel-core": "^6.7.7",
     "babel-eslint": "^6.0.4",
-    "babel-plugin-transform-runtime": "^6.8.0",
-    "babel-preset-es2015": "^6.6.0",
-    "babel-preset-stage-2": "^6.5.0",
     "babel-register": "^6.8.0",
     "chai": "^3.0.0",
     "deep-freeze": "0.0.1",
@@ -41,6 +38,9 @@
     "babel-runtime": "^6.6.1",
     "immutable-ops": "^0.4.2",
     "lodash": "^4.12.0",
+    "babel-plugin-transform-runtime": "^6.8.0",
+    "babel-preset-es2015": "^6.6.0",
+    "babel-preset-stage-2": "^6.5.0",
     "reselect": "^2.0.1"
   }
 }
@tommikaikkonen
Copy link
Collaborator

Thank you for opening the issue. Sorry for the delay, I was on a trip for a couple of weeks.

I tried to reproduce your issue but I'm having trouble. It seems like Babel is trying to compile the library files, even though it's been already compiled?

The redux-orm build process uses Babel plugins and presets to generate ES5 to the lib folder, which is the code that is imported when users require redux-orm in their own projects. babel-plugin-transform-runtime adds requires and calls to the babel-runtime library instead of inlining the code. So in the lib folder, the only remaining dependency from Babel should be babel-runtime. You can verify that by going to the redux-orm folder in the node_modules folder of your project and looking at the files.

babel-runtime is already in the dependencies in package.json. There should be no need to add the presets and babel-plugin-transform-runtime to dependencies. I don't know how you arrived at that error.

I just updated redux-orm-primer with the latest version of redux-orm. If you try cloning that, and running

npm install
npm run start

Do you get an error?

@otiai10
Copy link
Author

otiai10 commented Jun 27, 2016

Thank you very much, and I hope your trip was great.

It seems like Babel is trying to compile the library files, even though it's been already compiled?

hmm, I have 1 thing I can imagine. Probably, this is because I'm using react-native, and it executes compiling with running.

And your redux-orm-primer works well. Thank you very much and it's very good to know for me.

@otiai10 otiai10 closed this as completed Jun 27, 2016
@kevando
Copy link

kevando commented Aug 28, 2016

Hey @otiai10 what did you do to get orm working with react-native? I cant seem to get past these same babel errors

@kevando
Copy link

kevando commented Aug 28, 2016

I am not familiar with Babel, so still struggling here.

@otiai10
Copy link
Author

otiai10 commented Aug 30, 2016

@kevando Hi, how about it?

npm install babel-plugin-transform-runtime babel-preset-es2015 babel-preset-stage-2

@hckhanh
Copy link

hckhanh commented Sep 25, 2017

Please keep in mine that babel-plugin-transform-runtime is only used for Development. If you want to use for Production, use babel-runtime.
Refer: https://babeljs.io/docs/plugins/transform-runtime/

@henrymoulton
Copy link

henrymoulton commented Jul 4, 2018

This issue is still occurring when using React Native with Expo. The above advice works for me on version 0.9.4. But later versions of redux-orm have a different Babel setup see PR #206.

Therefore my advice is to look at the .babelrc file in /node_modules/redux-orm and install those plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants