Skip to content

Commit 2443e05

Browse files
authored
test(resolve): add test case for #20972 (#20975)
1 parent ff2d83e commit 2443e05

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

playground/resolve/__tests__/resolve.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ test('Resolving with query with imports field', async () => {
228228
)
229229
})
230230

231+
test('Resolving dot-prefixed directory with imports field', async () => {
232+
expect(await page.textContent('.imports-dot-prefixed')).toMatch('[success]')
233+
})
234+
231235
test("Resolve doesn't interrupt page request with trailing query and .css", async () => {
232236
await page.goto(viteTestUrl + '/?test.css')
233237
expect(await page.locator('vite-error-overlay').count()).toBe(0)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const msg = '[success] dot-prefixed subpath imports'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { msg } from '#dot-prefixed'
2+
3+
export { msg }

playground/resolve/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ <h2>Resolving from other package with imports field</h2>
6464
<h2>Resolving with query with imports field</h2>
6565
<p class="imports-query">fail</p>
6666

67+
<h2>Resolving dot-prefixed directory with imports field</h2>
68+
<p class="imports-dot-prefixed">fail</p>
69+
6770
<h2>Resolve /index.*</h2>
6871
<p class="index">fail</p>
6972

@@ -272,6 +275,9 @@ <h2>utf8-bom-package</h2>
272275
import importsQuery from '#query?url'
273276
text('.imports-query', importsQuery)
274277

278+
import { msg as importsDotPrefixed } from './imports-path/importer.js'
279+
text('.imports-dot-prefixed', importsDotPrefixed)
280+
275281
// implicit index resolving
276282
import { foo } from './util'
277283
text('.index', foo())

playground/resolve/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"#star/*": "./imports-path/star/*",
1717
"#slash/": "./imports-path/slash/",
1818
"#other-pkg-slash/": "@vitejs/test-resolve-imports-pkg/nest/",
19-
"#query": "./imports-path/query.json"
19+
"#query": "./imports-path/query.json",
20+
"#dot-prefixed": "./imports-path/.dot-prefixed/index.js"
2021
},
2122
"dependencies": {
2223
"@babel/runtime": "^7.28.4",

0 commit comments

Comments
 (0)