Skip to content
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

wip: debugging modules that export themselves as functions #2410

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vite-node/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ function exportAll(exports: any, sourceModule: any) {
if (exports === sourceModule)
return

if (typeof sourceModule !== 'object' || Array.isArray(sourceModule) || !sourceModule)
// TODO: replace the check for `object` with something that will not iterate over strings
// Right now, modules that are functions do not work.
// Removing this line `typeof sourceModule !== 'object'` causes libraries (like openseadragon)
// to work (so long as they do not mutate their keys/exports dynamically).
if (Array.isArray(sourceModule) || !sourceModule)
return

for (const key in sourceModule) {
Expand Down