This repository has been archived by the owner on Oct 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
62 lines (61 loc) · 1.51 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: "development",
entry: path.resolve("src", "app.tsx"),
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
output: {
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader"
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader"
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: "Todo App with MVVM",
hash: true,
inject: false,
scriptLoading: 'blocking',
meta: {
charset: 'utf-8'
},
templateContent: function ({ htmlWebpackPlugin }) {
return `<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta charset="utf-8">
${htmlWebpackPlugin.tags.headTags}
<title>${htmlWebpackPlugin.options.title}</title>
</head>
<body>
<div id="app"></div>
${htmlWebpackPlugin.tags.bodyTags}
</body>
</html>`;
}
})
],
devServer: {
compress: true,
port: 9000,
open: true
}
};