-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
61 lines (59 loc) · 1.33 KB
/
webpack.config.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
53
54
55
56
57
58
59
60
61
var JSON5 = require('json5')
var Html = require('html-webpack-plugin')
var Copy = require('copy-webpack-plugin')
var MiniCssExtract = require('mini-css-extract-plugin')
var { encode } = require('msgpack-lite/lib/encode')
var { readFileSync } = require('fs')
var rules = require('./webpack.rules')
rules.push({
test: /\.styl$/,
use: ['style-loader', 'css-loader?importLoaders=true', 'stylus-loader'],
exclude: [/node_modules/]
})
module.exports = {
mode: 'development',
entry: [
'react-hot-loader/patch',
'./src/index.jsx', // your app's entry point
],
devtool: process.env.WEBPACK_DEVTOOL || 'eval-source-map',
output: {
publicPath: '/',
filename: 'bundle.js',
clean: true
},
resolve: {
extensions: ['.mjs', '.js', '.jsx']
},
module: {
rules
},
plugins: [
new MiniCssExtract({
filename: 'style.css'
}),
new Html({
template: './src/template.html',
files: {
css: ['style.css'],
js: [ "bundle.js"],
}
}),
new Copy({
patterns: [
{
from: 'data/*.json5',
to: 'msgpack/[name].msgpack',
transform: (content, file) => encode(JSON5.parse(readFileSync(file, 'utf8')))
},
]
})
],
optimization: {
emitOnErrors: true
},
devServer: {
historyApiFallback: true,
hot: true
}
}