Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve import path for dynamic imports (#817)
- Loading branch information
1 parent
d03bc30
commit e37f4de
Showing
7 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
test('dynamic relative import works', async() => { | ||
const { timeout } = await import('./../src/timeout') | ||
|
||
const timeoutPath = './../src/timeout' | ||
const { timeout: dynamicTimeout } = await import(timeoutPath) | ||
|
||
expect(timeout).toBe(dynamicTimeout) | ||
}) | ||
|
||
test('dynamic aliased import works', async() => { | ||
const { timeout } = await import('./../src/timeout') | ||
|
||
const timeoutPath = '@/timeout' | ||
const { timeout: dynamicTimeout } = await import(timeoutPath) | ||
|
||
expect(timeout).toBe(dynamicTimeout) | ||
}) | ||
|
||
test('dynamic absolute import works', async() => { | ||
const { timeout } = await import('./../src/timeout') | ||
|
||
const timeoutPath = '/src/timeout' | ||
const { timeout: dynamicTimeout } = await import(timeoutPath) | ||
|
||
expect(timeout).toBe(dynamicTimeout) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters