File tree Expand file tree Collapse file tree 4 files changed +56
-4
lines changed Expand file tree Collapse file tree 4 files changed +56
-4
lines changed Original file line number Diff line number Diff line change 99 < body class ="dark:bg-gray-900 ">
1010 < div id ="app "> </ div >
1111 < script type ="module " src ="/src/main.ts "> </ script >
12+ < script >
13+ // GitHub Pages SPA redirect
14+ ( function ( l ) {
15+ if ( l . search [ 1 ] === '/' ) {
16+ var decoded = l . search . slice ( 1 ) . split ( '&' ) . map ( function ( s ) {
17+ return s . replace ( / ~ a n d ~ / g, '&' )
18+ } ) . join ( '?' ) ;
19+ window . history . replaceState ( null , null ,
20+ l . pathname . slice ( 0 , - 1 ) + decoded + l . hash
21+ ) ;
22+ }
23+ } ( window . location ) )
24+ </ script >
1225 </ body >
1326</ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Redirecting...</ title >
7+ < script >
8+ // GitHub Pages SPA redirect
9+ // This script takes the current URL and converts the path and query
10+ // string into just a query string, and then redirects the browser
11+ // to that URL with new query string + hash, and no path.
12+ //
13+ // For example:
14+ // /foo/bar/baz?abc=123#def
15+ // becomes:
16+ // /?p=/foo/bar/baz&q=abc%3D123#def
17+ //
18+ // Note: any hash in the original URL is preserved in the hash.
19+ var pathSegmentsToKeep = 1 ;
20+
21+ var l = window . location ;
22+ l . replace (
23+ l . protocol + '//' + l . hostname + ( l . port ? ':' + l . port : '' ) +
24+ l . pathname . split ( '/' ) . slice ( 0 , 1 + pathSegmentsToKeep ) . join ( '/' ) + '/?/' +
25+ l . pathname . slice ( 1 ) . split ( '/' ) . slice ( pathSegmentsToKeep ) . join ( '/' ) . replace ( / & / g, '~and~' ) +
26+ ( l . search ? '&' + l . search . slice ( 1 ) . replace ( / & / g, '~and~' ) : '' ) +
27+ l . hash
28+ ) ;
29+ </ script >
30+ </ head >
31+ < body >
32+ < p > Redirecting...</ p >
33+ </ body >
34+ </ html >
Original file line number Diff line number Diff line change 1- import { createRouter , createWebHashHistory , createWebHistory } from 'vue-router'
1+ import { createRouter , createWebHistory } from 'vue-router'
22
33const router = createRouter ( {
4- history : import . meta. env . PROD
5- ? createWebHashHistory ( )
6- : createWebHistory ( import . meta. env . BASE_URL ) ,
4+ history : createWebHistory ( import . meta. env . BASE_URL ) ,
75 scrollBehavior ( to , from , savedPosition ) {
86 return savedPosition || { left : 0 , top : 0 }
97 } ,
Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ export default defineConfig({
1414 '@' : fileURLToPath ( new URL ( './src' , import . meta. url ) ) ,
1515 } ,
1616 } ,
17+ build : {
18+ rollupOptions : {
19+ output : {
20+ manualChunks : undefined ,
21+ } ,
22+ } ,
23+ } ,
1724} )
You can’t perform that action at this time.
0 commit comments