1 | var path = require('path');
|
2 | var webpack = require('webpack');
|
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
4 |
|
5 | var plugins = [
|
6 | new webpack.NoErrorsPlugin(),
|
7 | new webpack.optimize.OccurenceOrderPlugin(),
|
8 | new webpack.DefinePlugin({
|
9 | 'process.env': {
|
10 | 'NODE_ENV': JSON.stringify('production')
|
11 | }
|
12 | }),
|
13 | new webpack.optimize.UglifyJsPlugin({
|
14 | compressor: {
|
15 | screw_ie8: true,
|
16 | warnings: false
|
17 | }
|
18 | })
|
19 | ]
|
20 |
|
21 | module.exports = {
|
22 | devtool: 'cheap-source-map',
|
23 | resolve: {
|
24 | extensions: ['', '.js']
|
25 | },
|
26 | entry: [ './src/index' ],
|
27 | output: {
|
28 | filename: 'bundle.js',
|
29 | path: path.join(__dirname, 'dist'),
|
30 | libraryTarget: 'umd',
|
31 | library: 'Input'
|
32 | },
|
33 | externals: {
|
34 | react: {
|
35 | root: 'React',
|
36 | commonjs2: 'react',
|
37 | commonjs: 'react',
|
38 | amd: 'react'
|
39 | }
|
40 | },
|
41 | plugins: plugins,
|
42 | module: {
|
43 | loaders: [
|
44 | {
|
45 | test: /\.js$/,
|
46 | loaders: ['babel-loader'],
|
47 | include: /src/
|
48 | },
|
49 | {
|
50 | test: /\.css$/,
|
51 | loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader',
|
52 | exclude: /node_modules/
|
53 | }
|
54 | ]
|
55 | }
|
56 | };
|