Skip to content

Commit 11156f9

Browse files
fix(cli): avoid removing relative imports during md -> mdx conversion (#189)
1 parent 14af6cb commit 11156f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/convertToMDX.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function removeNoLiveTags(content: string): string {
4646
}
4747

4848
function removeExistingImports(content: string): string {
49-
// Remove imports that don't end in .css
50-
const importRegex = /^import {?[\w\s,\n]*}? from ['"](?!.*\.css['"])[^'"]*['"];?\n/gm
49+
// Remove imports that are absolute and not CSS
50+
const importRegex = /^import {?[\w\s,\n]*}? from ['"](?!\.\.?\/)(?!.*\.css['"])[^'"]*['"];?\n/gm
5151
return content.replace(importRegex, '')
5252
}
5353

0 commit comments

Comments
 (0)