Answer the question
In order to leave comments, you need to log in
Webpack does not find module '@babel/core'. How to fix?
Hello. Webpack build issue. I installed babel and all its accessories, I run it, but it does not find the module, writes Cannot find module '@babel/core', BUT I have it in package.json.
webpack.config code
let path = require('path');
let conf = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'main.js',
publicPath: 'dist/'
},
devServer: {
overlay: true
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader'
//exclude: '/node_modules/'
}
]
}
};
module.exports = conf;
{
"name": "webpacklolol",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --mode development --open",
"build": "webpack --mode production"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.0.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"path": "^0.12.7",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.6"
},
"dependencies": {}
}
Answer the question
In order to leave comments, you need to log in
Some package of your dependencies requires babel 7+, and you have 6.
Read, update.
https://babeljs.io/blog/2018/08/27/7.0.0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question