Skip to content

Commit 73f9876

Browse files
authored
feat(dogfooding): make app use public path (#133)
1 parent fc978bd commit 73f9876

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

examples/dogfooding/index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<meta charset="UTF-8" />
55
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
66
<title>Waku Dogfooding - Refactored</title>
7-
<link rel="apple-touch-icon" href="./favicon.png" />
8-
<link rel="manifest" href="./manifest.json" />
9-
<link rel="icon" href="./favicon.ico" />
10-
<link rel="stylesheet" href="./style.css" />
7+
<link rel="apple-touch-icon" href="<%= htmlWebpackPlugin.options.publicPath %>favicon.png" />
8+
<link rel="manifest" href="<%= htmlWebpackPlugin.options.publicPath %>manifest.json" />
9+
<link rel="icon" href="<%= htmlWebpackPlugin.options.publicPath %>favicon.ico" />
10+
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.publicPath %>style.css" />
1111
</head>
1212
<body>
1313
<div class="app-container">
@@ -57,6 +57,5 @@ <h2>Message Log</h2>
5757
<p>Waku Dogfooding App - Modern UI</p>
5858
</footer>
5959
</div>
60-
<script src="./index.js"></script>
6160
</body>
6261
</html>

examples/dogfooding/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"@libp2p/interface": "^2.1.3",
1919
"@types/node": "^20.12.11",
2020
"copy-webpack-plugin": "^11.0.0",
21-
"html-webpack-plugin": "^5.6.3",
2221
"eslint": "^8",
2322
"eslint-config-next": "13.5.6",
23+
"html-webpack-plugin": "^5.6.3",
2424
"ts-loader": "^9.5.1",
2525
"typescript": "^5.4.5",
2626
"webpack": "^5.74.0",

examples/dogfooding/webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const CopyWebpackPlugin = require("copy-webpack-plugin");
2+
const HtmlWebpackPlugin = require("html-webpack-plugin");
23
const path = require("path");
34

45
const isProduction = process.env.NODE_ENV === 'production';
@@ -32,9 +33,18 @@ module.exports = {
3233
global: false
3334
},
3435
plugins: [
36+
new HtmlWebpackPlugin({
37+
template: "index.html",
38+
filename: "index.html",
39+
inject: 'head',
40+
scriptLoading: 'defer',
41+
publicPath: publicPath,
42+
templateParameters: {
43+
removeScript: true
44+
}
45+
}),
3546
new CopyWebpackPlugin({
3647
patterns: [
37-
{ from: "index.html", to: "index.html" },
3848
{ from: "public/style.css", to: "style.css" },
3949
{ from: "manifest.json", to: "manifest.json" },
4050
{ from: "favicon.ico", to: "favicon.ico" },

0 commit comments

Comments
 (0)