-
Notifications
You must be signed in to change notification settings - Fork 271
/
index.html
60 lines (54 loc) · 1.95 KB
/
index.html
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
<!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" />
<script>
const { href } = window.location;
const decoded = decodeURIComponent(href);
if (href !== decoded) {
window.location.href = decoded;
}
// Resolve the correct address from different deployment base paths.
const base = location.pathname.endsWith('/')
? location.pathname.slice(0, -1)
: location.pathname;
// https://exp.com => 'exp.com'
// https://exp.com/ => 'exp.com'
// https://exp.com/page-spy => 'exp.com/page-spy'
// https://exp.com/page-spy/ => 'exp.com/page-spy'
window.DEPLOY_BASE_PATH = location.host + base;
const sourceBaseUrl = `${location.protocol}//${window.DEPLOY_BASE_PATH}`;
const loadScript = (src, cb) => {
const script = document.createElement('script');
script.src = src;
script.onload = () => {
cb && cb();
};
document.head.appendChild(script);
};
// source-map
const sourcemapSDK = sourceBaseUrl + '/source-map/source-map.min.js';
const mappingWasmUrl = sourceBaseUrl + '/source-map/mappings.wasm';
loadScript(sourcemapSDK, () => {
window.sourceMap.SourceMapConsumer.initialize({
'lib/mappings.wasm': mappingWasmUrl,
});
});
// shiki
const shikiSDK = sourceBaseUrl + '/shiki/dist/index.jsdelivr.iife.js';
const shikiCDN = sourceBaseUrl + '/shiki';
loadScript(shikiSDK, () => {
window.shiki.setCDN(shikiCDN);
});
</script>
</head>
<body>
<div id="root"></div>
<script src="/src/main.tsx" type="module"></script>
</body>
</html>