diff --git a/packages/vite-node/src/client.ts b/packages/vite-node/src/client.ts index 0b32672bc..0d721405f 100644 --- a/packages/vite-node/src/client.ts +++ b/packages/vite-node/src/client.ts @@ -214,12 +214,6 @@ export class ViteNodeRunner { if (importee && id.startsWith(VALID_ID_PREFIX)) importee = undefined id = normalizeRequestId(id, this.options.base) - // should be checked after normalization - // provide importer only for relative and absolute paths - // paths like "src/user" are valid for transformRequest, but they will be resolved incorrectly, - // if importer is provided - because they will be treated as relative to the importer instead of root - if (!id.startsWith('/') && !id.startsWith('./') && !id.startsWith('../')) - importee = undefined if (!this.shouldResolveId(id)) return [id, id] const { path, exists } = toFilePath(id, this.root) diff --git a/test/core/test/imports.test.ts b/test/core/test/imports.test.ts index 2fe0b6215..874f236b0 100644 --- a/test/core/test/imports.test.ts +++ b/test/core/test/imports.test.ts @@ -46,13 +46,6 @@ test('dynamic absolute with extension mport works', async () => { expect(stringTimeoutMod).toBe(variableTimeoutMod) }) -test('dynamic baseUrl import works', async () => { - const staticMod = await import('./../src/timeout') - // @ts-expect-error there is no tsconfig in test/core to handle baseUrl - const dynamicMod = await import('src/timeout') - expect(staticMod).toBe(dynamicMod) -}) - test('data with dynamic import works', async () => { const dataUri = 'data:text/javascript;charset=utf-8,export default "hi"' const { default: hi } = await import(dataUri)