-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathwebpack.dev.conf.js
52 lines (50 loc) · 1.76 KB
/
webpack.dev.conf.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
52
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var path = require('path')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
var CopyWebpackPlugin = require('copy-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
})
module.exports = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
// cheap-module-eval-source-map is faster for development
devtool: '#cheap-module-eval-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
favicon: path.resolve(__dirname, '../app/static/icon/favicon.ico'),
inject: true
}),
new HtmlWebpackPlugin({
filename: 'embedded.html',
template: 'embedded.html',
favicon: path.resolve(__dirname, '../app/static/icon/favicon.ico'),
inject: true
}),
new FriendlyErrorsPlugin(),
// copy project- / app-specific static assets
new CopyWebpackPlugin([
{
context: path.resolve(__dirname, '../app/static'),
from: "*",
to: config.build.assetsSubDirectory
}
])
]
})