Раньше всегда устанавливал пакеты в общий конфиг, сейчас решил в devDependencies кидать, но начало выдавать ошибку:
Мой package.json:
{
"name": "aviasales_test",
"version": "1.0.0",
"main": "index.js",
"author": "Nikita Shchypylov <sn97@icloud.com>",
"license": "MIT",
"dependencies": {
"webpack": "^4.1.1",
"webpack-cli": "^2.0.11",
"webpack-dashboard": "^1.1.1"
},
"scripts": {
"build": "webpack"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.0.6",
"react": "^16.2.0",
"react-dom": "^16.2.0"
}
}
webpack.config.json:
const path = require("path");
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: ["./src/index.js"],
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["env"]
}
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./public/index.html",
filename: "./index.html"
})
]
};
Результат :
ERROR in multi ./src/index.js
Module not found: Error: Can't resolve 'babel-loader' in '/Users/nikulio/Documents/work/react/aviasales_test'
@ multi ./src/index.js
Как это пофиксить?