1

When run Webpack Dev Server it creates hash files but doesn't create real physical files - so Get 404 Error But if run Builder with Watcher it creates real hash files and I can get it from server directly

BUT: HMR says to Get different Hash then is created by Builder

SO: I have one real Hash Bundle and can get from the http://localhost:8000/..., but my Browser want get another Hash bundle that is not exist in the resource folder

raven.js:1074 GET http://localhost:8080/004e386432676c218bd0.hot-update.json 404 (Not Found)

Strange thing: next string showed twice

2 raven.js:80 [WDS] App updated. Recompiling... -> TWICE

Config below:

var buildPath = __dirname + '/public/js/bundles';
module.exports = {
    context: path.join(__dirname, '/resources/scripts'),
    devtool: process.env.NODE_ENV === 'production' ? null : 'inline-source-map',
    entry: {
        ...entries...
        campaigns: [
            'webpack/hot/only-dev-server',
            'webpack-dev-server/client?http://localhost:8080',
            './appjs/campaigns/campaignsEntry.js',
        ]
    },
    output: {
        path: buildPath,
        publicPath: 'http://localhost:8080/',
        filename: process.env.NODE_ENV === 'production' ? '[name]-bundle-[chunkhash].js' : '[name]-bundle.js'
    },
    devServer: {
        hot: true,
        contentBase: buildPath,
        publicPath: 'http://localhost:8080',
        port: 8080,
        headers: { "Access-Control-Allow-Origin": "*" },
        lazy: false,
        stats: { colors: true }
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: ['es2015-loose', 'react'],
                    plugins: ['transform-object-rest-spread', 'transform-class-properties']
                }
            }
        ]
    },
    plugins: [
        new webpack.NoEmitOnErrorsPlugin(),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
        }),
        new webpack.optimize.OccurrenceOrderPlugin(),
    ]
};
if (process.env.NODE_ENV === 'production') {
...
} else {
    module.exports.plugins.push(
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NamedModulesPlugin()
    );
}
kosiakMD
  • 923
  • 7
  • 22

0 Answers0