Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 887
Seneca Avatar asked Nov 09 '15 12:11

Seneca


People also ask

Is Babel required for Webpack?

We need webpack to bundle our code and webpack-cli is a command-line tool that uses webpack to do the same. Also webpack requires babel-loader to transpile our ES6 code to ES5 before bundling (Remember, what I said about being responsible developers 😃).

What is difference between Webpack and Babel?

Babel can be classified as a tool in the "JavaScript Compilers" category, while Webpack is grouped under "JS Build Tools / JS Task Runners".

Can not Resolve babel-loader?

To solve the error "Module not found: Error: Can't resolve 'babel-loader'", make sure to install the babel-loader package by opening your terminal in your project's root directory and running the command npm install -D babel-loader and restart your development server.


2 Answers

npm uninstall babel --save-dev

This fixed it. Babel package is deprecated...

like image 106
Seneca Avatar answered Sep 22 '22 17:09

Seneca


npm install babel-loader --save-dev
like image 38
Warren Zhou Avatar answered Sep 21 '22 17:09

Warren Zhou