-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
51 lines (45 loc) · 1.29 KB
/
webpack.dev.js
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
const webpack = require('webpack')
const base = require('./webpack.base')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const OpenBrowserPlugin = require('open-browser-webpack-plugin')
// config
const { config } = base
config.entry = [
'react-hot-loader/patch',
`webpack-dev-server/client?http://${base.DEFAULT_HOST}:${base.DEFAULT_PORT}`,
'webpack/hot/only-dev-server',
base.APP_PATH
]
config.output = {
path: base.BUILD_PATH,
filename: 'js/[name].js',
chunkFilename: 'js/[name].js'
}
config.module.rules.push(
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
exclude: base.NODE_MODULES_PATH,
include: base.SRC_PATH
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
exclude: base.NODE_MODULES_PATH,
include: base.SRC_PATH
}
)
config.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html'
}),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map'
}),
new OpenBrowserPlugin({ url: `http://${base.DEFAULT_HOST}:${base.DEFAULT_PORT}` })
)
module.exports = base