UNPKG

1.81 kBJavaScriptView Raw
1var webpack = require('webpack');
2
3var __DEV__ = JSON.parse(process.env.NODE_ENV !== 'production');
4var __STANDALONE__ = process.argv.some(function(arg) {return arg === '--standalone'});
5
6module.exports = {
7 entry: './src/index.js',
8 module: {
9 loaders: [
10 {
11 test: /\.js$/,
12 loader: 'babel',
13 exclude: /node_modules/,
14 query: {
15 presets: ['es2015', 'stage-1']
16 }
17 }
18 ]
19 },
20 output: {
21 filename: __STANDALONE__ ?
22 (
23 'dist/style-it-standalone.js'
24 )
25 :
26 (
27 __DEV__ ?
28 'dist/style-it.js'
29 :
30 'dist/style-it.min.js'
31 )
32 ,
33 libraryTarget: 'umd',
34 library: 'Style'
35 },
36 externals: {
37 "react": {
38 root: 'React',
39 commonjs2: 'react',
40 commonjs: 'react',
41 amd: 'react'
42 },
43 'react-dom': {
44 root: 'ReactDOM',
45 commonjs2: 'react-dom',
46 commonjs: 'react-dom',
47 amd: 'react-dom'
48 }
49 },
50 plugins: __DEV__ ?
51 [
52 new webpack.optimize.OccurenceOrderPlugin(),
53 new webpack.DefinePlugin({
54 'process.env': {
55 'NODE_ENV': JSON.stringify('production')
56 }
57 })
58 ]
59 : // else __PROD__
60 [
61 new webpack.optimize.OccurenceOrderPlugin(),
62 new webpack.DefinePlugin({
63 'process.env': {
64 'NODE_ENV': JSON.stringify('production')
65 }
66 }),
67 new webpack.optimize.UglifyJsPlugin({
68 compressor: {
69 warnings: true,
70 screw_ie8: true, // React doesn't support IE8
71 unused: true,
72 dead_code: true,
73 },
74 mangle: {
75 screw_ie8: true,
76 except: ['Style', 'exports', 'default']
77 },
78 output: {
79 comments: false,
80 screw_ie8: true,
81 }
82 })
83 ]
84 ,
85};
\No newline at end of file