我想构建我的 js/css 代码,将其写入磁盘并在单个命令中使用 webpack-dev-server 为其提供服务。我不想为生产模式设置另一台服务器。我们该怎么做呢?在下面分享我的 webpack.config.js 文件内容:
module.exports = {
watch: true,
entry: [
'./src/index.js'
],
output: {
path: __dirname +'/dist/',
publicPath: '/dist/',
filename: 'bundle.js'
},
module: {
loaders: [
{
exclude:/(node_modules)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};
请在下面的 package.json 中找到使用的启动脚本:
"start": "webpack-dev-server --progress --colors"
我正在运行“npm run start”。请帮忙。