-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 importing xstate with ssr.noExternal causes SyntaxError: Unexpected token '.' #2667
Labels
Comments
GrygrFlzr
added
pending triage
bug
p4-important
Violate documented behavior or significantly improves performance (priority)
and removed
pending triage
labels
Mar 24, 2021
FYI: probably a dirty hack but I managed to work around this limitation by doing import { ... } from 'xstate/dist/xstate.web'; (instead of |
leemove
added a commit
to leemove/vite
that referenced
this issue
Apr 13, 2021
leemove
added a commit
to leemove/vite
that referenced
this issue
Apr 13, 2021
leemove
added a commit
to leemove/vite
that referenced
this issue
Apr 13, 2021
9 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Describe the bug
When evaluating
xstate
as an SSR module while it's defined inssr.noExternal
, Vite fails to evaluate the module.It seems to be failing here in Vite:
vite/packages/vite/src/node/ssr/ssrModuleLoader.ts
Lines 121 to 130 in 6fae0b7
When evaluating this file, this section:
...produces this invalid JS:
Vite is incorrectly substituting the local
error
variable with an SSR import variable.Reproduction
https://github.com/GrygrFlzr/vite-xstate
git clone https://github.com/GrygrFlzr/vite-xstate.git cd vite-xstate npm i npm run dev
Visit http://localhost:3000 to receive:
System Info
Used package manager: npm 7.6.1
Also tested against the current main branch 6fae0b7.
The text was updated successfully, but these errors were encountered: