-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.ts
48 lines (46 loc) · 1.16 KB
/
webpack.config.ts
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const port = process.env.PORT || 3000;
const ci = Boolean(process.env.CI || false);
module.exports = {
mode: 'development',
entry: {
app: './src/index.tsx'
},
module: {
rules: [
{
test: /\.(ts|tsx)?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', 'jsx'],
},
output: {
filename: '[name].js',
chunkFilename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/webpack-react-ts-mpa-example/'
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
filename: 'index.html'
}),
new HtmlWebpackPlugin({
template: 'public/404.html',
filename: '404.html'
}),
],
devServer: {
host: 'localhost',
port: port,
historyApiFallback: true,
open: ci?['/webpack-react-ts-mpa-example']:false,
static: __dirname+'/dist',
hot: true
}
};