Browse Source

Merge pull request #3375 from nocodb/chore/hash-based-routing

vue3: hash based routing
pull/3376/head
navi 2 years ago committed by GitHub
parent
commit
f1330a7389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nc-gui-v2/nuxt.config.ts
  2. 1
      packages/nc-gui-v2/package-lock.json
  3. 3
      packages/nc-gui-v2/package.json
  4. 20
      packages/nc-gui-v2/scripts/updateNuxtRouting.js

2
packages/nc-gui-v2/nuxt.config.ts

@ -13,7 +13,7 @@ export default defineNuxtConfig({
ssr: false,
app: {
baseURL: '/dashboard/',
baseURL: process.env.NODE_ENV === 'production' ? '.' : undefined,
},
css: [
'virtual:windi.css',

1
packages/nc-gui-v2/package-lock.json generated

@ -4,6 +4,7 @@
"requires": true,
"packages": {
"": {
"hasInstallScript": true,
"dependencies": {
"@ckpack/vue-color": "^1.2.0",
"@vuelidate/core": "^2.0.0-alpha.44",

3
packages/nc-gui-v2/package.json

@ -10,7 +10,8 @@
"test:ui": "vitest -c test/vite.config.ts --ui",
"coverage": "vitest -c test/vite.config.ts run --coverage",
"build:copy": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/",
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2"
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2",
"postinstall": "node scripts/updateNuxtRouting.js"
},
"dependencies": {
"@ckpack/vue-color": "^1.2.0",

20
packages/nc-gui-v2/scripts/updateNuxtRouting.js

@ -0,0 +1,20 @@
/** 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` */
const updatedContent = content.replace(
/createWebHistory(\s*,\s*)createMemoryHistory/,
`createWebHashHistory as createWebHistory$1createMemoryHistory`,
)
/** Update file content with updated code */
fs.writeFileSync(filePath, updatedContent, 'utf8')
Loading…
Cancel
Save