-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
60 lines (55 loc) · 1.39 KB
/
webpack.dev.js
File metadata and controls
60 lines (55 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import webpack from 'webpack'
import assign from 'object-assign'
import webpackDevMiddleware from 'webpack-dev-middleware'
import webpackHotMiddleware from 'webpack-hot-middleware'
import prodCfg from './webpack.prod.config.js'
import hot from './hot'
const DotenvPlugin = require('webpack-dotenv-plugin')
Object.assign = assign
export default function(app) {
const config = Object.assign(prodCfg, {
devtool: 'inline-source-map',
entry: ['babel-polyfill', 'webpack-hot-middleware/client', './client'],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader?cacheDirectory=true'
}
},
{
test: /\.less$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'less-loader',
options: {
sourceMap: true
}
}
]
}
]
},
plugins: [
new DotenvPlugin({
sample: './.env.example',
path: './.env'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoEmitOnErrorsPlugin()
]
})
hot(app, config)
}