我正在开发一个React项目,我在其中配置了Web包。
在localhost,我正在运行webpack-dev-server,它工作正常。
自从过去几天开始,当我执行Ctrl + c时,我开始收到以下消息。
还有一个问题,即如果在项目中进行了任何更改,则此开发服务器不会自动重新加载服务器和浏览器。
vishal@vishal-pc:~/Desktop/web-app$ node[12104]: ../src/node.cc:4012:void node::PlatformExit(): Assertion `(err) != (-1)' failed.
1: node::Abort() [node]
2: 0x893875 [node]
3: 0x897872 [node]
4: 0x7f8ad503cff8 [/lib/x86_64-linux-gnu/libc.so.6]
5: 0x7f8ad503d045 [/lib/x86_64-linux-gnu/libc.so.6]
6: 0x893a94 [node]
7: 0xb00af9 [node]
8: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
9: 0x3b50720041bd
对于每一次更改,我都需要停止开发服务器并再次运行它。
Webpack.config
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
module.exports = (env) => {
const isProduction = env === 'production';
const CSSExtract = new ExtractTextPlugin('styles.css');
return {
entry: ['babel-polyfill','./src/app.js'],
output: {
path : path.join(__dirname, 'public', 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
},
{
test: /\.css$/,
use: CSSExtract.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
}
]
})
},
{
test: /\.(png|jp(e*)g|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8000,
name: 'images/[hash]-[name].[ext]',
publicPath: '/dist/'
}
}
]
},
{
test: /\.(woff|woff2|eot|ttf|otf|mp4)$/,
use: [
{
loader: "file-loader",
options: {
name: 'files/[hash]-[name].[ext]',
publicPath: '/dist/'
}
}
]
}
]
},
plugins: [
CSSExtract,
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
"window.jQuery": "jquery"
})
],
devtool: isProduction ? 'source-map' : 'cheap-module-eval-source-map',
devServer: {
contentBase: path.join(__dirname, 'public'),
historyApiFallback: true,
publicPath: '/dist/'
}
}
}