Seneca
Seneca

Reputation: 2412

Webpack Babel 6

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 babelto babel-core?

Upvotes: 19

Views: 12089

Answers (5)

Thiện Trần Hữu
Thiện Trần Hữu

Reputation: 21

Change loader: "babel", => loader: "babel-loader", in webpack config

Hope this help! it's work for me

Upvotes: 2

Deepan Prabhu Babu
Deepan Prabhu Babu

Reputation: 912

I did both these commands, then it started working !!

npm uninstall babel --save-dev
npm install babel-loader --save-dev

Upvotes: 1

hunter2009
hunter2009

Reputation: 153

I think it should be used like this:

var babel = require('babel-core');
babel.transform(code, babelOptions);

Upvotes: 0

Warren Zhou
Warren Zhou

Reputation: 294

npm install babel-loader --save-dev

Upvotes: 12

Seneca
Seneca

Reputation: 2412

npm uninstall babel --save-dev

This fixed it. Babel package is deprecated...

Upvotes: 51

Related Questions