Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add environment specific configs for webpack
- Loading branch information
Josh
committed
Mar 22, 2017
1 parent
d292cd1
commit 28dc0bc
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const env = process.env.NODE_ENV || 'development'; | ||
const __DEV__ = env === 'development'; | ||
const __PROD__ = env === 'production'; | ||
|
||
module.exports = { | ||
entry: './src/es5-gfycat-sdk', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'gfycat-sdk.umd.bundle.min.js', | ||
filename: __DEV__ ? 'gfycat-sdk.umd.bundle.js' : 'gfycat-sdk.umd.bundle.min.js', | ||
publicPath: '/assets/', | ||
library: 'GfycatSDK', | ||
libraryTarget: 'umd' | ||
}, | ||
devtool: 'source-map', | ||
target: 'web', | ||
plugins: [ | ||
plugins: __PROD__ ? [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false, | ||
drop_console: false | ||
} | ||
}) | ||
] | ||
] : [], | ||
watch: __DEV__ | ||
}; |