Describe the bug
When running a module like
import { foo } from '$lib/things.js';
export const get = () => foo // no semicolon
through Vite's SSR transform, I end up with
const __vite_ssr_import_0__ = await __vite_ssr_import__("/src/lib/things.js");
const get = () => __vite_ssr_import_0__.foo
rather than the correct
const __vite_ssr_import_0__ = await __vite_ssr_import__("/src/lib/things.js");
const get = () => foo
Object.defineProperty(__vite_ssr_exports__, "get", { enumerable: true, configurable: true, get(){ return get }});
As far as I can tell, defineExport is getting called correctly, and it is adding the appropriate Object.defineProperty call, but the magic-string call at
|
s.overwrite(id.start, id.end, binding) |
is removing it again.
Reproduction
https://github.com/Conduitry-Repros/vite-7365
System Info
System:
OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 9.80 GB / 12.32 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Yarn: 1.22.15
npm: 8.5.2
Used Package Manager
pnpm
Logs
Validations
Describe the bug
When running a module like
through Vite's SSR transform, I end up with
rather than the correct
As far as I can tell,
defineExportis getting called correctly, and it is adding the appropriateObject.definePropertycall, but themagic-stringcall atvite/packages/vite/src/node/ssr/ssrTransform.ts
Line 210 in ed4d191
Reproduction
https://github.com/Conduitry-Repros/vite-7365
System Info
System: OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa) CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz Memory: 9.80 GB / 12.32 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Yarn: 1.22.15 npm: 8.5.2Used Package Manager
pnpm
Logs
Validations