Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): handle default arguments properly in
ssrTransform
Previously, any Identifier nodes that were both (1) used in a default argument expression and (2) referenced an import binding would not be rewritten to point to the transformed import binding. For example: ```ts import Foo from './foo' export function hello(arg = Foo.foo) {} ``` …would be transformed into something like: ```ts const __vite_ssr_import_0__ = __vite_ssr_import__('./foo') function hello(arg = Foo.foo) {} Object.defineProperty(__vite_ssr_exports__, "hello", { enumerable: true, value: hello }) ``` …so the `Foo.foo` reference would result in a runtime error.
- Loading branch information