Skip to content

Commit

Permalink
fix: should filter vite virtual files
Browse files Browse the repository at this point in the history
fix #50
  • Loading branch information
qmhc committed Jan 11, 2022
1 parent f59d8fc commit 5fb24ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/plugin.ts
Expand Up @@ -52,6 +52,7 @@ export interface PluginOptions {
}

const noneExport = 'export {};\n'
const virtualPrefix = '\0'
const vueRE = /\.vue$/
const tsRE = /\.tsx?$/
const jsRE = /\.jsx?$/
Expand Down Expand Up @@ -182,6 +183,10 @@ export function dtsPlugin(options: PluginOptions = {}): Plugin {
},

transform(code, id) {
if (id.startsWith(virtualPrefix)) {
return null
}

if (vueRE.test(id)) {
const { content, ext } = compileVueCode(code)

Expand Down

0 comments on commit 5fb24ba

Please sign in to comment.