Skip to content

Commit

Permalink
update webpack config.
Browse files Browse the repository at this point in the history
  • Loading branch information
carloluis committed Feb 22, 2018
1 parent 32a67d1 commit 64a51f1
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^0.1.18",
"copy-webpack-plugin": "^4.4.1",
"coveralls": "^3.0.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.0",
Expand Down
17 changes: 14 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');

const PATHS = {
Expand All @@ -11,7 +12,7 @@ const PATHS = {
};

const productionFlag = process.argv.indexOf('-p') !== -1;
const NODE_ENV = productionFlag? 'production': 'development';
const NODE_ENV = productionFlag ? 'production' : 'development';

const envPluginConfig = new webpack.DefinePlugin({
'process.env': {
Expand Down Expand Up @@ -57,7 +58,17 @@ module.exports = {
}
]
},
plugins: [envPluginConfig, commonsChunkConfig, htmlWebpackPluginConfig],
plugins: [
envPluginConfig,
commonsChunkConfig,
htmlWebpackPluginConfig,
new CopyWebpackPlugin([
{
from: path.join(PATHS.example, 'favicon.ico'),
to: path.join(PATHS.dist, 'favicon.ico')
}
])
],
resolve: {
extensions: ['.js', '.jsx']
},
Expand Down
Loading

0 comments on commit 64a51f1

Please sign in to comment.