mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
993 B
27 lines
993 B
2 years ago
|
/** A temporary solution to enable hash based routing until
|
||
|
* nuxt-team merges - https://github.com/nuxt/framework/pull/6980
|
||
|
*/
|
||
|
|
||
|
const fs = require('fs')
|
||
|
const path = require('path')
|
||
|
|
||
|
const filePath = path.join(__dirname, '..', 'node_modules', 'nuxt', 'dist', 'pages', 'runtime', 'router.mjs')
|
||
|
|
||
|
/** Read file content to be updated */
|
||
|
const content = fs.readFileSync(filePath, 'utf8')
|
||
|
|
||
|
/** Replace `createWebHistory` with `createWebHashHistory` */
|
||
2 years ago
|
const updatedContent = content
|
||
|
.replace(
|
||
|
/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);`,
|
||
|
)
|
||
2 years ago
|
|
||
|
/** Update file content with updated code */
|
||
|
fs.writeFileSync(filePath, updatedContent, 'utf8')
|