webpack-dev-middleware
とwebpack-hot-middleware
を数ヶ月使用していましたが、これはうまくいきましたが、何かが起こったため、webpackはファイルの変更を監視しています。何が起こるか?私はfs.inotify.max_user_watches = 524288
を設定し、:set backupcopy=yes
のvimオプションを設定してarch linuxを実行しています。 何が起こる可能性がありますか?物事を取り戻すには?Webpackミドルウェアがファイル変更の監視を停止しました
初期のバンドルが発生し、ミドルウェアがログに正しく表示されます。エントリーアプリでwebpack middlewaresをロードする行は次のとおりです。
(function() {
if (process.env.NODE_ENV === 'development') {
console.server('Running webpack middleware...');
var webpack = require('webpack');
var webpackConfig = require('../config/webpack.config.js');
var compiler = webpack(webpackConfig);
app.use(require("webpack-dev-middleware")(compiler, {
hot: true,
noInfo: false,
stats: {
colors: true
},
historyApiFallback: true,
publicPath: '',
contentBase: './app'
}));
app.use(require("webpack-hot-middleware")(compiler, {
log: console.webpack,
heartbeat: 10 * 1000
}));
}
})();
とwebpack.config.js
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const PATHS = {
app: {
client: path.resolve(__dirname, '../app'),
admin: path.resolve(__dirname, '../admin-app')
},
styles: path.resolve(__dirname, '../public/stylesheets'),
build: path.resolve(__dirname, '../public/build'),
public: path.resolve(__dirname, '../public')
};
const plugins = [
// Shared code
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
// Avoid publishing files when compilation fails
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
}),
new webpack.optimize.OccurenceOrderPlugin(),
new ExtractTextPlugin('stylesheet.css')
];
const config = {
env: process.env.NODE_ENV,
entry: {
client: [path.resolve(PATHS.app.client + '/index.js'), 'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr'],
admin: [path.resolve(PATHS.app.admin + '/index.js'), 'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr']
},
output: {
path: PATHS.build,
filename: '[name].bundle.js',
publicPath: '/'
},
stats: {
colors: true,
reasons: true
},
resolve: {
modulesDirectories: ['node_modules'],
alias: {},
extensions: ['', '.jsx', '.js']
},
module: {
loaders: [
{
test: /\.jsx?$/,
include: PATHS.app.client,
loaders: ['react-hot', 'babel']
},
{
test: /\.jsx?$/,
include: PATHS.app.admin,
loaders: ['react-hot', 'babel']
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', ['css-loader', 'postcss-loader', 'sass-loader'])
}
]
},
plugins: plugins,
devtool: 'eval'
};
module.exports = config;