Skip to content

Commit c5a10ec

Browse files
authored
fix: don't resolve as relative for specifiers starting with a dot (vitejs#20528)
1 parent d209a1b commit c5a10ec

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ markdownStyles: false
1515
import { useData } from 'vitepress'
1616
import { onBeforeUnmount, onMounted, ref } from 'vue'
1717

18-
import Hero from '.vitepress/theme/components/landing/1. hero-section/HeroSection.vue'
18+
import Hero from './.vitepress/theme/components/landing/1. hero-section/HeroSection.vue'
1919
import FeatureSection from './.vitepress/theme/components/landing/2. feature-section/FeatureSection.vue'
2020
import FrameworksSection from './.vitepress/theme/components/landing/3. frameworks-section/FrameworksSection.vue'
2121
import CommunitySection from './.vitepress/theme/components/landing/4. community-section/CommunitySection.vue'
2222
import SponsorSection from './.vitepress/theme/components/landing/5. sponsor-section/SponsorSection.vue'
23-
import GetStartedSection from '.vitepress/theme/components/landing/6. get-started-section/GetStartedSection.vue'
23+
import GetStartedSection from './.vitepress/theme/components/landing/6. get-started-section/GetStartedSection.vue'
2424
import FeatureInstantServerStart from './.vitepress/theme/components/landing/2. feature-section/FeatureInstantServerStart.vue'
2525
import FeatureHMR from './.vitepress/theme/components/landing/2. feature-section/FeatureHMR.vue'
2626
import FeatureRichFeatures from './.vitepress/theme/components/landing/2. feature-section/FeatureRichFeatures.vue'

packages/vite/src/node/plugins/resolve.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const optionalPeerDepId = '__vite-optional-peer-dep'
6565

6666
const subpathImportsPrefix = '#'
6767

68+
const relativePrefixRE = /^\.\.?(?:[/\\]|$)/
6869
const startsWithWordCharRE = /^\w/
6970

7071
const debug = createDebugger('vite:resolve-details', {
@@ -251,7 +252,7 @@ export function resolvePlugin(
251252

252253
// relative
253254
if (
254-
id[0] === '.' ||
255+
relativePrefixRE.test(id) ||
255256
((preferRelative ||
256257
resolveOpts.isEntry ||
257258
importer?.endsWith('.html')) &&

0 commit comments

Comments
 (0)