fix(ssr): hoist import statements to the top#12274
Conversation
|
|
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
|
cc @sheremet-va, I don't think this would affect vite-node but good to be aware of this change. |
Will not affect vite-node, but will break Vitest module mocking ( |
|
I need the 😬 emoji reaction to add to your response. How do we handle this merge to avoid issues in Vitest? Could |
There is a way to make it work with both versions, yes. Previously it relied on a behavior that SSR transform will not affect imports position, so "vi.mock" was hoisted before any "import" in the source code, and not in the transformed code and it was done as a Vite plugin. Now we will need to move it after the code is transformed and also somehow merge source maps, which was handled by Vite previously. |
|
@sheremet-va do you think we can move forward with this PR in 4.3? The stable cut for it may be released in 2-3 weeks. |
Should be fine if CI is passing |
|
/ecosystem-ci run vitest |
Description
fix #10444
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).