1 | const webpack = require('webpack') |
||
2 | const path = require('path') |
||
3 | const isProduction = process.env.NODE_ENV === 'production' |
||
4 | const dashboardPlugin = require('webpack-dashboard/plugin') |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
5 | |||
6 | module.exports = { |
||
7 | entry: { |
||
8 | app: ['babel-polyfill', 'whatwg-fetch', './src/index.js'], |
||
9 | vendor: [ |
||
10 | 'babel-plugin-transform-class-properties', |
||
11 | 'babel-plugin-transform-object-assign', |
||
12 | 'babel-plugin-transform-object-rest-spread', |
||
13 | 'babel-polyfill', |
||
14 | // 'lodash.pull', |
||
15 | // 'lodash.reject', |
||
16 | // 'lodash.uniqby', |
||
17 | 'react', |
||
18 | 'react-dom', |
||
19 | 'react-redux', |
||
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/assets'), |
||
32 | filename: 'tracim.app.entry.js', |
||
33 | pathinfo: !isProduction, |
||
34 | publicPath: '/assets/' |
||
35 | }, |
||
36 | devServer: { |
||
37 | contentBase: path.join(__dirname, 'dist/'), |
||
38 | host: '0.0.0.0', |
||
39 | port: 8090, |
||
40 | hot: true, |
||
41 | noInfo: true, |
||
42 | overlay: { |
||
43 | warnings: false, |
||
44 | errors: true |
||
45 | }, |
||
46 | historyApiFallback: true |
||
47 | // headers: { |
||
48 | // 'Access-Control-Allow-Origin': '*' |
||
49 | // } |
||
50 | }, |
||
51 | devtool: isProduction ? false : 'cheap-module-source-map', |
||
52 | module: { |
||
53 | rules: [{ |
||
54 | test: /\.jsx?$/, |
||
55 | enforce: 'pre', |
||
56 | use: 'standard-loader', |
||
57 | exclude: [/node_modules/] |
||
58 | }, { |
||
59 | test: [/\.js$/, /\.jsx$/], |
||
60 | loader: 'babel-loader', |
||
61 | options: { |
||
62 | presets: ['env', 'react'], |
||
63 | plugins: ['transform-object-rest-spread', 'transform-class-properties', 'transform-object-assign'] |
||
64 | }, |
||
65 | exclude: [/node_modules/] |
||
66 | }, { |
||
67 | test: /\.css$/, |
||
68 | use: ['style-loader', 'css-loader'] |
||
69 | }, { |
||
70 | test: /\.styl$/, |
||
71 | use: ['style-loader', 'css-loader', 'stylus-loader'] |
||
72 | }, { |
||
73 | test: /\.(jpg|png|svg)$/, |
||
74 | loader: 'file-loader', |
||
75 | options: { |
||
76 | name: '[name].[ext]', |
||
77 | outputPath: 'images/', // asset/ is in output.path |
||
78 | limit: 2000 |
||
79 | } |
||
80 | }] |
||
81 | }, |
||
82 | resolve: { |
||
83 | extensions: ['.js', '.jsx'] |
||
84 | }, |
||
85 | plugins:[ |
||
86 | ...[ // generic plugins always present |
||
87 | new webpack.optimize.CommonsChunkPlugin({ |
||
88 | name: 'vendor', |
||
89 | filename: 'tracim.vendor.bundle.js' |
||
90 | }) |
||
91 | // new dashboardPlugin() |
||
92 | ], |
||
93 | ...(isProduction |
||
94 | ? [ // production specific plugins |
||
95 | new webpack.DefinePlugin({ |
||
96 | 'process.env': { 'NODE_ENV': JSON.stringify('production') } |
||
97 | }), |
||
98 | new webpack.optimize.UglifyJsPlugin({ |
||
99 | compress: { warnings: false } |
||
100 | }) |
||
101 | ] |
||
102 | : [] // development specific plugins |
||
103 | ) |
||
104 | ] |
||
105 | } |
||
106 |