Привет всем, решил освоить webpack,
хотел разделить конфиг на модули
и при запуске
yarn run start появляется ошибка
"webpack-dev-server" не является внутренней или внешней командой
у меня стоит windows 10
как решить задачу?
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const devserver = require('./webpack/devserver');
const PATHS = {
source: path.join(__dirname, 'src'),
build: path.join(__dirname, 'build')
};
const common = merge([
{
entry: {
'index': PATHS.source + '/pages/index/index.js',
'blog': PATHS.source + '/pages/blog/blog.js'
},
output: {
path: PATHS.build,
filename: 'js/[name].js'
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
chunks: ['index', 'common'],
template: PATHS.source + '/pages/index/index.html'
}),
new HtmlWebpackPlugin({
filename: 'blog.html',
chunks: ['blog', 'common'],
template: PATHS.source + '/pages/blog/blog.html'
})
]
}
]);
module.exports = function(env) {
if (env === 'production'){
return merge([
common;
]);
}
if (env === 'development'){
return merge([
common,
devserver()
])
}
};
в package.json прописал {
"name": "yarn.dev",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --env development",
"build": "webpack --env production",
"serv": "static build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {
"html-loader": "^0.4.5",
"html-webpack-plugin": "^2.28.0",
"node-static": "^0.7.9",
"webpack": "^2.5.0",
"webpack-merge": "^4.1.0"
}
}