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
?
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 😃).
Babel can be classified as a tool in the "JavaScript Compilers" category, while Webpack is grouped under "JS Build Tools / JS Task Runners".
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.
npm uninstall babel --save-dev
This fixed it. Babel package is deprecated...
npm install babel-loader --save-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With