Skip to content

Instantly share code, notes, and snippets.

@stephencweiss
Last active December 10, 2018 14:40
Show Gist options
  • Save stephencweiss/62d2540daecdc3f9a8797b20c0698e16 to your computer and use it in GitHub Desktop.
Save stephencweiss/62d2540daecdc3f9a8797b20c0698e16 to your computer and use it in GitHub Desktop.
Template for customizing the webpack config file for modes development and production
//webpack.config.js
const path = require('path');
const SRC_DIR = path.resolve(__dirname, 'client')
const DIST_DIR = path.resolve(__dirname, 'public')
var config = {
entry: `${SRC_DIR}/index.jsx`,
output: {
filename: 'bundle.js',
path: DIST_DIR
}
}
module.exports = (env, argv) => {
if (argv.mode === "development") {
// settings that are customized *beyond* the defaults for the development mode
// config.devtool = 'source-map';
console.log(`Development mode!`)
}
if (argv.mode === "production") {
// settings that are customized *beyond* the defaults for the production mode
console.log(`Development mode!`)
}
return config;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment