Webpack中间件停止监视文件更改

时间:2016-06-14 10:27:53

标签: node.js express webpack webpack-hmr webpack-hot-middleware

我使用了webpack-hot-middlewarefs.inotify.max_user_watches = 524288几个月,它只是FINE,但是现在,发生了一些事情,webpack停止观察文件更改,所以只有在重新启动应用程序时才进行捆绑重建。怎么会发生什么?我在使用:set backupcopy=yes设置的arch linux上,并且调整了(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 })); } })(); vim选项。 怎么会发生什么?怎么回事?

初始捆绑发生,中间件正确加载,就像我在日志中看到的那样。以下是在入门应用程序中加载webpack中间件的行。

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;

 
    <form method="POST" id="saveuser" enctype="multipart/form-data">
         <input type="text" name="username" id="username"><br>
         <input type="password" name="pass" id="pass"><br>
         <input type="file" name="fileupload"><br>
         <input type="submit" name="submit" value="Confirm" id="confirm">
    </form>

1 个答案:

答案 0 :(得分:0)

Lol只是console.webpack函数中的一个愚蠢的错误,传递给webpack-hot-middleware log并没有让它发挥作用。当滚动到webpack提供的巨大日志外部的顶部时看到错误,这使得这个拼写错误如此隐蔽。