1 | 'use strict';
|
2 |
|
3 | var webpack = require('webpack');
|
4 |
|
5 | var plugins = [
|
6 | new webpack.optimize.OccurenceOrderPlugin(),
|
7 | new webpack.DefinePlugin({
|
8 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
|
9 | })
|
10 | ];
|
11 |
|
12 | if (process.env.NODE_ENV === 'production') {
|
13 | plugins.push(
|
14 | new webpack.optimize.UglifyJsPlugin({
|
15 | compressor: {
|
16 | screw_ie8: true,
|
17 | warnings: false
|
18 | }
|
19 | })
|
20 | );
|
21 | }
|
22 |
|
23 | module.exports = {
|
24 | module: {
|
25 | loaders: [{
|
26 | test: /\.js$/,
|
27 | loaders: ['babel-loader'],
|
28 | exclude: /node_modules/
|
29 | }]
|
30 | },
|
31 | output: {
|
32 | library: 'd3-state-visualizer',
|
33 | libraryTarget: 'umd'
|
34 | },
|
35 | plugins: plugins,
|
36 | resolve: {
|
37 | extensions: ['', '.js']
|
38 | }
|
39 | };
|