Full-Stack React Projects
上QQ阅读APP看书,第一时间看更新

Client-side Webpack configuration for production 

For preparing the client-side code for production, update the config object with the following code in your webpack.config.client.production.js file.

mern-simplesetup/webpack.config.client.production.js:

const config = {
mode: "production",
entry: [
path.join(CURRENT_WORKING_DIR, 'client/main.js')
],
output: {
path: path.join(CURRENT_WORKING_DIR , '/dist'),
filename: 'bundle.js',
publicPath: "/dist/"
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
'babel-loader'
]
}
]
}
}

This will configure Webpack for bundling the React code to be used in production mode, where the hot reloading plugin or debug configuration will no longer be required.