feat(dogfooding): make app use public path (#133)

This commit is contained in:
Sasha 2025-06-02 19:11:54 +02:00 committed by GitHub
parent fc978bd26d
commit 73f98767f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 7 deletions

View File

@ -4,10 +4,10 @@
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Waku Dogfooding - Refactored</title>
<link rel="apple-touch-icon" href="./favicon.png" />
<link rel="manifest" href="./manifest.json" />
<link rel="icon" href="./favicon.ico" />
<link rel="stylesheet" href="./style.css" />
<link rel="apple-touch-icon" href="<%= htmlWebpackPlugin.options.publicPath %>favicon.png" />
<link rel="manifest" href="<%= htmlWebpackPlugin.options.publicPath %>manifest.json" />
<link rel="icon" href="<%= htmlWebpackPlugin.options.publicPath %>favicon.ico" />
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.publicPath %>style.css" />
</head>
<body>
<div class="app-container">
@ -57,6 +57,5 @@
<p>Waku Dogfooding App - Modern UI</p>
</footer>
</div>
<script src="./index.js"></script>
</body>
</html>

View File

@ -18,9 +18,9 @@
"@libp2p/interface": "^2.1.3",
"@types/node": "^20.12.11",
"copy-webpack-plugin": "^11.0.0",
"html-webpack-plugin": "^5.6.3",
"eslint": "^8",
"eslint-config-next": "13.5.6",
"html-webpack-plugin": "^5.6.3",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.74.0",

View File

@ -1,4 +1,5 @@
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const isProduction = process.env.NODE_ENV === 'production';
@ -32,9 +33,18 @@ module.exports = {
global: false
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html",
filename: "index.html",
inject: 'head',
scriptLoading: 'defer',
publicPath: publicPath,
templateParameters: {
removeScript: true
}
}),
new CopyWebpackPlugin({
patterns: [
{ from: "index.html", to: "index.html" },
{ from: "public/style.css", to: "style.css" },
{ from: "manifest.json", to: "manifest.json" },
{ from: "favicon.ico", to: "favicon.ico" },