Open arnoldjos opened 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') } }) ] };
Webpack issue: https://github.com/webpack/webpack/issues/7516
@arnoldjos you could perhaps explicitly give your entry a name, e.g.
entry: { server: './server/renderer.js', // or main: './server/renderer.js' }
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') } }) ] };