Reputation: 2412
When I try to compile my javascript with webpack & babel-loader, I get: (Babel version 6+)
Hash: f6a14faa8862d530512e
Version: webpack 1.12.3
Time: 96ms
Asset Size Chunks Chunk Names
backend.js 1.75 kB 0 [emitted] main
backend.js.map 1.43 kB 0 [emitted] main
chunk {0} backend.js, backend.js.map (main) 28 bytes [rendered]
[0] multi main 28 bytes {0} [built] [1 error]
ERROR in The node API for `babel` has been moved to `babel-core`.
@ multi main
Patched!
How do I move the node API for babel
to babel-core
?
Upvotes: 19
Views: 12089
Reputation: 21
Change loader: "babel",
=> loader: "babel-loader",
in webpack config
Hope this help! it's work for me
Upvotes: 2
Reputation: 912
I did both these commands, then it started working !!
npm uninstall babel --save-dev
npm install babel-loader --save-dev
Upvotes: 1
Reputation: 153
I think it should be used like this:
var babel = require('babel-core');
babel.transform(code, babelOptions);
Upvotes: 0
Reputation: 2412
npm uninstall babel --save-dev
This fixed it. Babel package is deprecated...
Upvotes: 51