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