diff --git a/package.json b/package.json index 06b6d4f..3677813 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,10 @@ "build": "pnpm -r --filter='./packages/*' run build", "stub": "pnpm -r --parallel --filter='./packages/*' run stub", "lint": "eslint . --fix", - "format": "soy prettier-format", + "format": "soy prettier-write", "commit": "soy git-commit", "cleanup": "soy cleanup", - "ncu": "soy ncu", + "update-pkg": "soy ncu", "publish-pkg": "pnpm -r publish --access public", "release": "pnpm soy release && pnpm build && pnpm publish-pkg", "prepare": "pnpm -r run stub" diff --git a/packages/vue/src/context/index.ts b/packages/vue/src/context/index.ts index 90300ef..4672ecb 100644 --- a/packages/vue/src/context/index.ts +++ b/packages/vue/src/context/index.ts @@ -23,8 +23,6 @@ export default class ElegantVueRouter { genTransformFile(this.options); this.generate(); - - this.setupFSWatcher(); } scanPages() { diff --git a/packages/vue/src/context/transform.ts b/packages/vue/src/context/transform.ts index 34e2dbc..982a45e 100644 --- a/packages/vue/src/context/transform.ts +++ b/packages/vue/src/context/transform.ts @@ -84,7 +84,7 @@ export async function genTransformFile(options: ElegantVueRouterOption) { const transformPath = path.posix.join(options.cwd, options.transformDir); - ensureFile(transformPath); + await ensureFile(transformPath); await writeFile(transformPath, code); } diff --git a/packages/vue/src/unplugin.ts b/packages/vue/src/unplugin.ts index 8e09b23..c978aa9 100644 --- a/packages/vue/src/unplugin.ts +++ b/packages/vue/src/unplugin.ts @@ -10,8 +10,11 @@ export default createUnplugin | undefined>((opti return { name: '@elegant-router/vue', enforce: 'pre', - apply: 'serve', vite: { + apply: 'serve', + configResolved() { + ctx.setupFSWatcher(); + }, configureServer(server) { ctx.setViteServer(server); }