Skip to content

Commit

Permalink
Force webpack to move the production build under the dir
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrieleRomeo committed Oct 18, 2017
1 parent 49bcd20 commit 75494fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const path = require('path');

const isProduction = process.env.NODE_ENV === 'production';
const FILENAME = 'bundle';

const config = {
context: __dirname,
entry: './src/index.js',
entry: path.join(__dirname, 'src/index.js'),
devtool: 'cheap-eval-source-map',
output: {
path: path.join(__dirname, 'public/'),
filename: 'bundle.js',
filename: `${FILENAME}.js`,
},
devServer: {
publicPath: '/public/',
Expand Down Expand Up @@ -39,6 +40,8 @@ const config = {

if (isProduction === true) {
config.devtool = false;
config.output.path = path.join(__dirname, 'build/');
config.output.filename = `${FILENAME}.min.js`;
}

module.exports = config;

0 comments on commit 75494fc

Please sign in to comment.