-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
77 lines (76 loc) · 1.95 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
77
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin').TsconfigPathsPlugin
const CopyWebpackPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
module.exports = {
mode: 'development',
entry: {
bundle: [
'@babel/polyfill',
'./src/app/index.tsx',
],
},
output: {
path: `${__dirname}/dist`,
filename: 'bundle.[hash].js'
},
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, '/src/static'),
historyApiFallback: true,
hot: true,
inline: true,
stats: 'errors-only',
port: 11000,
host: '0.0.0.0',
// proxy: {
// '**': {
// target: 'http://0.0.0.0:11111',
// changeOrigin: true,
// },
// },
},
module: {
rules: [{
test: /\.tsx?$/,
use: [{
loader: "babel-loader",
options: {
cacheDirectory: true,
presets: [
'@babel/preset-react',
['@babel/preset-env', {
targets: {
browsers: ['last 2 versions', '> 1%'],
},
modules: false,
useBuiltIns: 'usage',
}],
],
plugins: [
'react-hot-loader/babel',
['@babel/plugin-proposal-decorators', { 'legacy': true }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-function-bind',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-modules-commonjs',
],
},
}, {
loader: 'ts-loader' ,
}]
}]
},
resolve: {
modules: ['src/app', 'src/common', 'node_modules'],
extensions: ['.ts', '.tsx', '.js'],
plugins: [new TsconfigPathsPlugin()]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/static/base.html',
}),
new webpack.HotModuleReplacementPlugin(),
]
}