I've followed the solutions on stackoverflow posts posted by different developers. However, none of them helped fix the issue I'm encountering. Few of the things I did are
All of the above never fixed this error
ERROR in The node API for `babel` has been moved to `babel-core`.
@ (webpack)-dev-server/client?http://localhost:3333 1:10-24
ERROR in The node API for `babel` has been moved to `babel-core`.
@ (webpack)-dev-server/client?http://localhost:3333 3:16-37
ERROR in The node API for `babel` has been moved to `babel-core`.
@ (webpack)-dev-server/client?http://localhost:3333 2:13-37
ERROR in (webpack)/~/process/browser.js
Module build failed: Error: Couldn't find preset "react" relative to directory "/Users/admin/.nvm/versions/node/v6.0.0/lib/node_modules/webpack/node_modules/process"
at /Users/admin/repos/ReactJSApps/react-es6-setup/node_modules/babel-core/lib/transformation/file/options/option-manager.js:395:17
at Array.map (native)
.
.
.
webpack: bundle is now VALID.
Here is my package.json
{
"name": "react-es6-setup",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.2.0",
"react-dom": "^15.2.0"
},
"devDependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1"
}
}
And webpack.config.js
module.exports = {
entry: './main.js',
output: {
path: './',
filename: 'index.js'
},
devServer: {
inline: true,
port: 3333
},
module: {
loaders: [
{
test: /\.js$/,
exclude: 'node_modules',
loader: 'babel',
query: {
presets: [ 'es2015', 'react' ]
}
}
]
}
}
and the dir listing of the node_modules
$ ls -l node_modules/ |grep react
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-helper-builder-react-jsx/
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-plugin-transform-react-display-name/
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-plugin-transform-react-jsx/
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-plugin-transform-react-jsx-self/
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-plugin-transform-react-jsx-source/
drwxr-xr-x 6 admim 207825898 204 Jul 6 02:02 babel-preset-react/
drwxr-xr-x 9 admim 207825898 306 Jul 6 02:03 react/
drwxr-xr-x 9 admim 207825898 306 Jul 6 02:03 react-dom/
Having loaders: 'babel-loader'
in webpack.config.js
fixed the issue for me-
install these dependencies using npm
"babel-core": "^6.1.2",
"babel-loader": "^6.1.0",
"babel-plugin-transform-runtime": "^6.1.2",
"babel-preset-es2015": "^6.1.2",
"babel-preset-stage-0": "^6.1.2",
"babel-runtime": "^5.8.0",
In webpack.config.js
file, have this code:
const path = require('path');
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'dist.js',
publicPath: "js"
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
}
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