Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Client-side Webpack configuration for production

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content