This repository has been archived by the owner on Dec 9, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathwebpack.config.js
76 lines (65 loc) · 1.45 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
// entry file - starting point for the app
entry: [
'@babel/polyfill',
'./frontend'
],
mode: 'production',
resolve: {
extensions: ['.js', '.jsx'],
modules: ['node_modules', 'frontend']
},
performance: {
hints: false
},
// where to dump the output of a production build
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.jsx?/i,
loader: 'babel-loader',
options: {
presets: [
'@babel/env'
],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-transform-react-jsx', { pragma: 'h' }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread'
]
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'automate kingdoms',
template: path.join(__dirname, 'frontend/index.html')
}),
new webpack.HotModuleReplacementPlugin()
],
devServer: {
// serve up any static files from src/
contentBase: path.join(__dirname, 'frontend'),
hot: true,
inline: true,
progress: true,
port: 9000,
proxy: {
'/api': 'http://localhost:3000'
},
// enable gzip compression:
compress: true,
// enable pushState() routing, as used by preact-router et al:
historyApiFallback: true
}
};