We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6868e9c commit 47197fbCopy full SHA for 47197fb
src/core/unplugin.ts
@@ -1,3 +1,4 @@
1
+import { isPackageExists } from 'local-pkg'
2
import { minimatch } from 'minimatch'
3
import { slash } from '@antfu/utils'
4
import { createUnplugin } from 'unplugin'
@@ -29,7 +30,7 @@ export default createUnplugin<Options>((options) => {
29
30
const exclude = config.optimizeDeps?.exclude || []
31
32
const imports = new Set((await ctx.unimport.getImports()).map(i => i.from)
- .filter(i => i.match(/^[a-z@]/) && !exclude.includes(i)))
33
+ .filter(i => i.match(/^[a-z@]/) && !exclude.includes(i) && isPackageExists(i)))
34
35
if (!imports.size)
36
return
0 commit comments