Skip to content

Commit

Permalink
fix: transform flags correctly, close #704
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 12, 2022
1 parent 00d2884 commit 596f2ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/slidev/node/plugins/patchTransform.ts
Expand Up @@ -12,11 +12,13 @@ export function createFixPlugins(
name: 'slidev:flags',
enforce: 'pre',
transform(code, id) {
if (id.endsWith('.vue')) {
if (id.match(/\.vue($|\?)/)) {
const original = code
define.forEach(([from, to]) => {
code = code.replace(new RegExp(from, 'g'), to)
})
return code
if (original !== code)
return code
}
},
},
Expand Down

0 comments on commit 596f2ce

Please sign in to comment.