-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
40 lines (36 loc) · 1.2 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
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const cwd = process.cwd()
const config = {
entry: ['./demo/index.js'],
output: {
path: path.join(cwd, '.tmp'),
filename: 'main.js'
},
module: {
rules: [
// Transpile ES2015 to ES5
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
// Load font files
{ test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/, loader: 'file-loader' },
{ test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader' }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin()
],
devServer: {
// contentBase: path.join(__dirname, 'public'), // boolean | string | array, static file location
compress: true, // enable gzip compression
historyApiFallback: true, // true for index.html upon 404, object for multiple paths
hot: true, // hot module replacement. Depends on HotModuleReplacementPlugin
https: false, // true for self-signed, object for cert authority
noInfo: true, // only errors & warns on hot reload
port: 3000
},
target: 'web',
devtool: 'inline-source-map'
}
module.exports = config