-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
SSR throws Syntax Error for valid JavaScript #2409
Comments
I am certain this is an edge case in the SSR transformation step. Here is the transformed code that is throwing the error from my repro: const __vite_ssr_import_0__ = __vite_ssr_import__("vue")
__vite_ssr_exports__.default = {
install() {
const { test: __vite_ssr_import_0__.inject } = { test: true }
console.log(__vite_ssr_import_0__.inject)
}
} So it seems |
underfin
added a commit
to rolldown/vite
that referenced
this issue
Mar 7, 2021
yyx990803
pushed a commit
that referenced
this issue
Mar 15, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Vite in library mode can produce minified code that looks something like this shape:
The use of two
x
comes from the minifier doing its thing and should be valid. For some reason this shape (wherex
is used in two spots) causes the syntax errorIllegal property in declaration context
when instantiating the module at this line: https://github.com/vitejs/vite/blob/master/packages/vite/src/node/ssr/ssrModuleLoader.ts#L122.I am not familiar with the internals but I believe that the syntax error is introduced at some point in this transform step: https://github.com/vitejs/vite/blob/master/packages/vite/src/node/ssr/ssrTransform.ts#L26
Reproduction
https://github.com/JeffSchofield/vite-ssr-bug
System Info
vite
version: 2.0.5The text was updated successfully, but these errors were encountered: