April 2020
Intermediate to advanced
716 pages
18h 55m
English
To prepare 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 to bundle the React code to be used in production mode. The configuration here is similar to the client-side configuration for development mode, but without the hot-reloading ...