Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(v6): add runner dynamic import test #17422

Closed

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Jun 8, 2024

Description

I'm testing alpha.18 hi-ogawa/vite-environment-examples#91 and found that import(/* @vite-ignore */ someAboslutePath) is returning a duplicate module. I added a failing test case in this PR.

Copy link

stackblitz bot commented Jun 8, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

sheremet-va commented Jul 19, 2024

This does seem consistent with how Vite works: Vite server expects the URL, but instead, you pass down the full path. The server says that this module doesn't exist:

environment.moduleGraph.getModuleByUrl('/src/basic.js') // exists
environment.moduleGraph.getModuleByUrl('<root>/src/basic.js') // doesn't exist

There is an inconsistency when you call runner.import directly - it will shorten the path to avoid accidental duplicated modules. So we should either make it fail, or also shorten the path for dynamic imports inside the processed code 🤷🏻

It does seem more like a bug because in Node.js this code will work correctly 🤔

@sheremet-va
Copy link
Member

Should be fixed by 01246e5 (#16471)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants