|
@@ -0,0 +1,93 @@
|
|
1
|
+const webpack = require('webpack')
|
|
2
|
+const path = require('path')
|
|
3
|
+const isProduction = process.env.NODE_ENV === 'production'
|
|
4
|
+
|
|
5
|
+module.exports = {
|
|
6
|
+ entry: {
|
|
7
|
+ app: ['babel-polyfill', './src/index.js'],
|
|
8
|
+ vendor: [
|
|
9
|
+ 'babel-plugin-transform-class-properties',
|
|
10
|
+ 'babel-plugin-transform-object-assign',
|
|
11
|
+ 'babel-plugin-transform-object-rest-spread',
|
|
12
|
+ 'babel-polyfill',
|
|
13
|
+ // 'lodash.pull',
|
|
14
|
+ // 'lodash.reject',
|
|
15
|
+ // 'lodash.uniqby',
|
|
16
|
+ 'react',
|
|
17
|
+ 'react-dom',
|
|
18
|
+ 'react-redux',
|
|
19
|
+ 'react-router',
|
|
20
|
+ // 'react-router-dom',
|
|
21
|
+ // 'react-select',
|
|
22
|
+ 'redux',
|
|
23
|
+ 'redux-logger',
|
|
24
|
+ // 'redux-saga',
|
|
25
|
+ 'redux-thunk',
|
|
26
|
+ // 'whatwg-fetch',
|
|
27
|
+ // 'classnames'
|
|
28
|
+ ]
|
|
29
|
+ },
|
|
30
|
+ output: {
|
|
31
|
+ path: path.resolve(__dirname, 'dist'),
|
|
32
|
+ filename: 'tracim.app.entry.js',
|
|
33
|
+ pathinfo: !isProduction
|
|
34
|
+ },
|
|
35
|
+ devServer: {
|
|
36
|
+ contentBase: path.join(__dirname, 'dist/'),
|
|
37
|
+ port: 8090,
|
|
38
|
+ hot: true,
|
|
39
|
+ noInfo: true,
|
|
40
|
+ overlay: {
|
|
41
|
+ warnings: false,
|
|
42
|
+ errors: true
|
|
43
|
+ }
|
|
44
|
+ // headers: {
|
|
45
|
+ // 'Access-Control-Allow-Origin': '*'
|
|
46
|
+ // }
|
|
47
|
+ },
|
|
48
|
+ devtool: isProduction ? false : 'cheap-eval-source-map',
|
|
49
|
+ module: {
|
|
50
|
+ rules: [{
|
|
51
|
+ test: /\.jsx?$/,
|
|
52
|
+ enforce: 'pre',
|
|
53
|
+ use: 'standard-loader',
|
|
54
|
+ exclude: [/node_modules/]
|
|
55
|
+ }, {
|
|
56
|
+ test: [/\.js$/, /\.jsx$/],
|
|
57
|
+ loader: 'babel-loader',
|
|
58
|
+ options: {
|
|
59
|
+ presets: ['env', 'react'],
|
|
60
|
+ plugins: ['transform-object-rest-spread', 'transform-class-properties', 'transform-object-assign']
|
|
61
|
+ },
|
|
62
|
+ exclude: [/node_modules/]
|
|
63
|
+ }, {
|
|
64
|
+ test: /\.css$/,
|
|
65
|
+ use: ['style-loader', 'css-loader']
|
|
66
|
+ }, {
|
|
67
|
+ test: /\.styl$/,
|
|
68
|
+ use: ['style-loader', 'css-loader', 'stylus-loader']
|
|
69
|
+ }]
|
|
70
|
+ },
|
|
71
|
+ resolve: {
|
|
72
|
+ extensions: ['.js', '.jsx']
|
|
73
|
+ },
|
|
74
|
+ plugins: isProduction
|
|
75
|
+ ? [
|
|
76
|
+ new webpack.optimize.CommonsChunkPlugin({
|
|
77
|
+ name: 'vendor',
|
|
78
|
+ filename: 'tracim.vendor.bundle.js'
|
|
79
|
+ }),
|
|
80
|
+ new webpack.DefinePlugin({
|
|
81
|
+ 'process.env': { 'NODE_ENV': JSON.stringify('production') }
|
|
82
|
+ }),
|
|
83
|
+ new webpack.optimize.UglifyJsPlugin({
|
|
84
|
+ compress: { warnings: false }
|
|
85
|
+ })
|
|
86
|
+ ]
|
|
87
|
+ : [
|
|
88
|
+ new webpack.optimize.CommonsChunkPlugin({
|
|
89
|
+ name: 'vendor',
|
|
90
|
+ filename: 'tracim.vendor.bundle.js'
|
|
91
|
+ })
|
|
92
|
+ ]
|
|
93
|
+}
|