60frames / webpack-hot-server-middleware

:fire: Hot reload webpack bundles on the server
MIT License
324 stars 50 forks source link

My entry chunk is renamed to an async chunk #78

Open arnoldjos opened 6 years ago

arnoldjos commented 6 years ago

I am having issues when adding magic comments to my dynamic import using react-reloadable, Instead of receiving "main" i get "Home" which is a loadable component.

Here is my server config.

const path = require('path'); const webpack = require('webpack'); const externals = require('./node-externals'); const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

module.exports = { name: 'server', target: 'node', externals, entry: './server/renderer.js', mode: 'development', output: { filename: 'dev-server-bundle.js', chunkFilename: '[name].js', path: path.resolve(__dirname, '../build'), libraryTarget: 'commonjs2' }, devtool: 'inline-sourcemaps', module: { rules: [ { test: /.js$/, exclude: /node_modules/, use: [ { loader: 'babel-loader' } ] }, { test: /.css$/, use: { loader: 'css-loader', options: { minimize: true } } }, { test: /.scss$/, use: [ { loader: 'css-loader', options: { minimize: true } }, { loader: 'postcss-loader' }, { loader: 'sass-loader' } ] }, { test: /.(jpg|png|gif)$/, use: [ { loader: 'file-loader', options: { name: '/images/[name].[ext]', emitFile: false } } ] } ] }, plugins: [ new FriendlyErrorsWebpackPlugin(), new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('development') } }) ] };

threehams commented 6 years ago

Webpack issue: https://github.com/webpack/webpack/issues/7516

richardscarrott commented 5 years ago

@arnoldjos you could perhaps explicitly give your entry a name, e.g.

entry: {
   server: './server/renderer.js', // or main: './server/renderer.js'
}