You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Found this issue testing my app with vitest. I've asked in vitest repo in case it was an issue on their side, but seems it is not.
Looks like imported named exports are not being correctly transformed when used in object desctructuring while building for SSR (this is what vitest uses to transform files while testing).
import{createServer}from'vite';constserver=awaitcreateServer({});constcode=`import { CODE } from './path'console.log(CODE);export const func = ({ [CODE]: result }) => result;`;constresult=awaitserver.ssrTransform(code);console.log(result.code);
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
Note: Found this issue testing my app with vitest. I've asked in vitest repo in case it was an issue on their side, but seems it is not.
Looks like imported named exports are not being correctly transformed when used in object desctructuring while building for SSR (this is what vitest uses to transform files while testing).
Outputs:
As can be seen,
CODE
is not correctly referenced in line 5.I would expect to get something like:
Originally posted by @inakiabt in vitest-dev/vitest#1789
Reproduction
https://stackblitz.com/edit/node-h31zjx?file=index.js
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: