fix(vm): fix external module resolve error with deps optimizer query for encoded URI#10658
Conversation
|
Note: This is only a fix for ONE cleanUrl, there are quite a few, maybe time for a cleanup? |
|
Why does vm receive an encoded string when cleaning the URL? Is it passed down incorrectly? |
There was a problem hiding this comment.
The only source of glitch seems like the single point here in getCachedVitestImport
cleanUrl side.
Unfortunately, we get ?v=xxx only when vitest is inside node_modules so that seems like the reason we don't repro in our e2e.
|
I just debugged, for me it's a few lines later: I'll push the fix soon. |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
| const externalize = id.startsWith('file://') | ||
| ? id | ||
| : pathToFileURL(id).toString() | ||
| : decodeURIComponent(pathToFileURL(id).toString()) |
There was a problem hiding this comment.
From what I can guess, the idea isn't decoding. The idea is to have pathToFileURL to not include ?param by splitting id so it aligns with the fix on consumer side #10024.
There was a problem hiding this comment.
Perhaps something like this here and below.
const { file, postfix } = splitFileAndPostfix(id)
const externalize = id.startsWith('file://') ? id : `${pathToFileURL(file)}${postfix}`There was a problem hiding this comment.
No problem at all, that works, too
There was a problem hiding this comment.
Pushed a version that will include the param but returns a non-encoded URI
@vitest/browser
@vitest/browser-playwright
@vitest/browser-preview
@vitest/browser-webdriverio
@vitest/coverage-istanbul
@vitest/coverage-v8
@vitest/expect
@vitest/mocker
@vitest/pretty-format
@vitest/snapshot
@vitest/spy
@vitest/ui
@vitest/utils
vitest
@vitest/web-worker
commit: |
|
This means vm + optimizer has been broken entire v4 phase. We may want to backport this to v4. |
Yes, I'm on v4 and I will backport it |
|
Please, backport to v4 branch |
|
See #10661 10661 |
Description
Resolves #10657
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ciChangesets
feat:,fix:,perf:,docs:, orchore:.