Skip to content

Commit

Permalink
fix: fix hookpath path handling error
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwusanyu-c committed Aug 29, 2023
1 parent 127d680 commit 311138a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import skRouterGuard from 'vite-plugin-sk-router-guard'
import Inspect from 'vite-plugin-inspect'
export default defineConfig({
plugins: [
skRouterGuard(),
skRouterGuard({
hookPath: './router-guard.skrg.ts'
}),
sveltekit(),
Inspect(),
],
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { transformPage } from "./transform/transform-page";
import { parsePageScript } from "./parse/parse-page-script";

export function getHookPath(projectPath: string, hookPath: string |undefined) {
let finalHookPath = `${projectPath}/${path}`
let finalHookPath = normalizePath(path.resolve(projectPath, hookPath || ''))
const rgTsPath = 'src/utils/router-guard.skrg.ts'
const rgJsPath = 'src/utils/router-guard.skrg.js'
if(!hookPath || hookPath === 'utils'){
Expand Down

0 comments on commit 311138a

Please sign in to comment.