Skip to content

Commit

Permalink
feat: improve performance by adding quick checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz committed Mar 13, 2023
1 parent 3e66005 commit 170a2b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ export default function cresateNavigarePlugin(options: Options = {}): Plugin {
return code
}

// Heuristic check if we need to parse the code expensively
if (!['route', '@navigare'].some((keyword) => code.includes(keyword))) {
return code
}

// Remember used routes
const usedRoutes: string[] = []

Expand Down

0 comments on commit 170a2b3

Please sign in to comment.