1 | const webpack = require('webpack');
|
2 | const path = require('path');
|
3 | const autoprefixer = require('autoprefixer');
|
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
5 |
|
6 | const APP = path.join(__dirname, 'example/src');
|
7 | const BUILD = path.join(__dirname, 'example/lib');
|
8 |
|
9 |
|
10 | module.exports = {
|
11 | entry: {
|
12 | index: APP,
|
13 | },
|
14 | output: {
|
15 | path: BUILD,
|
16 | filename: '[name].js',
|
17 | publicPath: '/'
|
18 | },
|
19 | resolve: {
|
20 | extensions: ['', '.js', '.jsx', '.css', '.scss'],
|
21 | modulesDirectories: [
|
22 | 'node_modules',
|
23 | path.resolve(__dirname, './node_modules')
|
24 | ]
|
25 | },
|
26 | module: {
|
27 | loaders: [
|
28 | {
|
29 | test: /\.jsx?$/,
|
30 | exclude: /node_modules/,
|
31 | loader: 'babel-loader',
|
32 | query: {
|
33 | presets: ['react', 'es2015', 'stage-0']
|
34 | }
|
35 | },
|
36 | {test: /\.css$/, loader: "style-loader!css-loader"}
|
37 |
|
38 | ]
|
39 | },
|
40 |
|
41 | devtool: 'cheap-module-source-map',
|
42 | plugins: [
|
43 | new webpack.DefinePlugin({
|
44 | 'process.env': {
|
45 | 'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
|
46 | }
|
47 | }),
|
48 | new webpack.optimize.UglifyJsPlugin({
|
49 | compress: {
|
50 | warnings: false
|
51 | }
|
52 | })
|
53 | ]
|
54 | }; |
\ | No newline at end of file |