diff options
Diffstat (limited to 'app/config/webpack/dev.js')
-rw-r--r-- | app/config/webpack/dev.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/app/config/webpack/dev.js b/app/config/webpack/dev.js new file mode 100644 index 00000000..97abc5eb --- /dev/null +++ b/app/config/webpack/dev.js | |||
@@ -0,0 +1,61 @@ | |||
1 | const webpackMerge = require('webpack-merge'); | ||
2 | const webpack = require('webpack'); | ||
3 | const commonConfig = require('./common.js'); | ||
4 | |||
5 | module.exports = function () { | ||
6 | return webpackMerge(commonConfig(), { | ||
7 | devtool: 'eval-source-map', | ||
8 | output: { | ||
9 | filename: '[name].dev.js', | ||
10 | }, | ||
11 | |||
12 | devServer: { | ||
13 | hot: true, | ||
14 | // enable HMR on the server | ||
15 | |||
16 | contentBase: './web', | ||
17 | // match the output path | ||
18 | }, | ||
19 | plugins: [ | ||
20 | new webpack.HotModuleReplacementPlugin(), | ||
21 | ], | ||
22 | module: { | ||
23 | rules: [ | ||
24 | { | ||
25 | enforce: 'pre', | ||
26 | test: /\.js$/, | ||
27 | loader: 'eslint-loader', | ||
28 | exclude: /node_modules/, | ||
29 | }, | ||
30 | { | ||
31 | test: /\.js$/, | ||
32 | exclude: /(node_modules)/, | ||
33 | use: { | ||
34 | loader: 'babel-loader', | ||
35 | options: { | ||
36 | presets: ['env'], | ||
37 | }, | ||
38 | }, | ||
39 | }, | ||
40 | { | ||
41 | test: /\.(s)?css$/, | ||
42 | use: [ | ||
43 | 'style-loader', | ||
44 | { | ||
45 | loader: 'css-loader', | ||
46 | options: { | ||
47 | importLoaders: 1, | ||
48 | }, | ||
49 | }, | ||
50 | 'postcss-loader', | ||
51 | 'sass-loader', | ||
52 | ], | ||
53 | }, | ||
54 | { | ||
55 | test: /\.(jpg|png|gif|svg|ico|eot|ttf|woff|woff2)$/, | ||
56 | use: 'url-loader', | ||
57 | }, | ||
58 | ], | ||
59 | }, | ||
60 | }); | ||
61 | }; | ||