|
|
@ -11,10 +11,16 @@ const filePath = path.join(__dirname, '..', 'node_modules', 'nuxt', 'dist', 'pag |
|
|
|
const content = fs.readFileSync(filePath, 'utf8') |
|
|
|
const content = fs.readFileSync(filePath, 'utf8') |
|
|
|
|
|
|
|
|
|
|
|
/** Replace `createWebHistory` with `createWebHashHistory` */ |
|
|
|
/** Replace `createWebHistory` with `createWebHashHistory` */ |
|
|
|
const updatedContent = content.replace( |
|
|
|
const updatedContent = content |
|
|
|
/createRouter(\s*,\s*)createWebHistory(\s*,\s*)createMemoryHistory/, |
|
|
|
.replace( |
|
|
|
`createRouter$1createWebHashHistory as createWebHistory$2createMemoryHistory`, |
|
|
|
/createRouter(\s*,\s*)createWebHistory(\s*,\s*)createMemoryHistory/, |
|
|
|
) |
|
|
|
`createRouter$1createWebHashHistory as createWebHistory$2createMemoryHistory`, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
/** Replace initial Handle initial routing based on hash path */ |
|
|
|
|
|
|
|
.replace( |
|
|
|
|
|
|
|
`const { pathname, search, hash } = location;`, |
|
|
|
|
|
|
|
`const { pathname, search, hash } = new URL((location.hash || '').replace(/^#/, ''), location.origin);`, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
/** Update file content with updated code */ |
|
|
|
/** Update file content with updated code */ |
|
|
|
fs.writeFileSync(filePath, updatedContent, 'utf8') |
|
|
|
fs.writeFileSync(filePath, updatedContent, 'utf8') |
|
|
|