We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1cc45a3 commit 82cf701Copy full SHA for 82cf701
packages/config/src/vite/index.js
@@ -13,13 +13,13 @@ import dts from 'vite-plugin-dts'
13
function ensureImportFileExtension({ content, extension }) {
14
// replace e.g. `import { foo } from './foo'` with `import { foo } from './foo.js'`
15
content = content.replace(
16
- /(im|ex)port\s[\w{}/*\s,]+from\s['"]\.\.?\/[^.'"]+(?=['"];?)/gm,
+ /(im|ex)port\s[\w{}/*\s,]+from\s['"](?:\.\.?\/)+?[^.'"]+(?=['"];?)/gm,
17
`$&.${extension}`,
18
)
19
20
// replace e.g. `import('./foo')` with `import('./foo.js')`
21
22
- /import\(['"]\.\.?\/[^.'"]+(?=['"];?)/gm,
+ /import\(['"](?:\.\.?\/)+?[^.'"]+(?=['"];?)/gm,
23
24
25
return content
0 commit comments