2016-02-12 62 views
2

Webpack熱重新加載僅適用於指定文件夾'react-frontend'中的文件,但不適用於該文件夾的子文件夾中的文件。奇怪的是,在我最近將我的機器從Ubuntu重置爲Debian之前它正在工作。我猜npm在這個新系統上安裝了稍微不同的版本。任何想法?Webpack React Hot Loading無法用於子文件夾中的文件

var path = require('path'); 
var webpack = require('webpack'); 
publicPath = 'http://localhost:3000/'; 


module.exports = { 
    devtool: 'eval', 
    node: { 
    fs: 'empty' 
    }, 
    entry: { 
    artistbox: [ 
     'webpack-dev-server/client?' + publicPath, 
     'webpack/hot/only-dev-server', 
     './react-frontend/artistbox' 
    ], 
    analysis: [ 
     'webpack-dev-server/client?' + publicPath, 
     'webpack/hot/only-dev-server', 
     './react-frontend/analysis' 
    ], 
    visualize: [ 
     'webpack-dev-server/client?' + publicPath, 
     'webpack/hot/only-dev-server', 
     './react-frontend/visualize' 
    ] 
    }, 
    output: { 
    path: path.join(__dirname, 'public', 'javascripts'), 
    filename: '[name].js', 
    publicPath: publicPath 
    }, 
    plugins: [ 
    new webpack.HotModuleReplacementPlugin() 
    ], 
    resolve: { 
    extensions: ['', '.js', '.cjsx', '.coffee'] 
    }, 
    module: { 
    loaders: [ 
     { 
     test: /\.js$/, 
     loaders: ['react-hot', 'babel'], 
     include: path.join(__dirname, 'react-frontend') 
     }, 
     { 
     test: /\.cjsx$/, 
     loaders: ['react-hot', 'coffee', 'cjsx'], 
     include: path.join(__dirname, 'react-frontend') 
     }, 
     { 
     test: /\.coffee$/, 
     loaders: ['coffee'], 
     include: path.join(__dirname, 'react-frontend') 
     } 
    ] 
    } 
}; 

編輯:好的我可以確定,原因不是webpack配置。我剛剛在我的Windows機器上部署了這個項目,它完美地工作。所以看起來它與Debian有關。事實上,我正在運行Linux Mint Debian Edition。

回答

3

是的,問題出在操作系統方面。看來Debian或Linux Mint Debian Edition具有相對較低的Inotify Watch限制。我正在使用的IntelliJ實際上給了我警告,我一直忽略它。

通過以下these instructions我可以解決這個問題。

+0

非常感謝!你救了我的夜晚! )) – Xander

相關問題