Skip to content

Commit

Permalink
fix: update public path in html
Browse files Browse the repository at this point in the history
  • Loading branch information
blucas.wu committed Nov 7, 2023
1 parent c7c08f3 commit 24a35c0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 31 deletions.
69 changes: 39 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PageSpy</title>
<link rel="icon" href="/favicon.ico">
<link rel="shortcut icon" type="image/svg+xml" href="/favicon.svg">
<% if (isDoc) { %>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PageSpy</title>
<link rel="icon" href="/favicon.ico" />
<link rel="shortcut icon" type="image/svg+xml" href="/favicon.svg" />
<% if (isDoc) { %>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TFP524RRV2"></script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-TFP524RRV2"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());

gtag('config', 'G-TFP524RRV2');
</script>
<% } %>
<script src="/source-map/source-map.min.js"></script>
<script>
const mappingWasmUrl = new URL('/source-map/mappings.wasm', window.location.href).toString()
sourceMap.SourceMapConsumer.initialize({
"lib/mappings.wasm": mappingWasmUrl
});
</script>
<script src="/shiki/dist/index.jsdelivr.iife.js"></script>
<script>
const shikiURL = new URL('/shiki', window.location.origin).toString()
window.shiki.setCDN(shikiURL)
</script>
</head>

<body>
<div id="root"></div>
<script src="/src/main.tsx" type="module"></script>
</body>
<% } %>
<script src="/source-map/source-map.min.js"></script>
<script>
const mappingWasmUrl = new URL(
'<%- base %>source-map/mappings.wasm',
window.location.origin,
).toString();
sourceMap.SourceMapConsumer.initialize({
'lib/mappings.wasm': mappingWasmUrl,
});
</script>
<script src="/shiki/dist/index.jsdelivr.iife.js"></script>
<script>
const shikiURL = new URL(
'<%- base %>shiki',
window.location.origin,
).toString();
window.shiki.setCDN(shikiURL);
</script>
</head>

<body>
<div id="root"></div>
<script src="/src/main.tsx" type="module"></script>
</body>
</html>
4 changes: 3 additions & 1 deletion vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import { ViteEjsPlugin } from 'vite-plugin-ejs';
export default ({ mode, command }) => {
const isDoc = mode === 'doc';
const isProd = command === 'build';
const base = isDoc ? '/page-spy-web/' : '/';

return defineConfig({
base: isDoc ? '/page-spy-web/' : '/',
base,
build: {
target: ['chrome100'],
sourcemap: isProd ? 'hidden' : true,
Expand All @@ -37,6 +38,7 @@ export default ({ mode, command }) => {
react(),
svgr(),
ViteEjsPlugin({
base,
isDoc,
}),
],
Expand Down

0 comments on commit 24a35c0

Please sign in to comment.