Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: missing xhr-sync-worker.js in jsdom #121

Merged
merged 6 commits into from
Jan 31, 2024
Merged

Conversation

jpedroschmitz
Copy link
Contributor

@jpedroschmitz jpedroschmitz commented Jan 30, 2024

Issue

Our library uses jsdom for DOM operations in Node.js environments. During the bundling process with tsup/esbuild, the module xhr-sync-worker.js from jsdom was not being correctly resolved, leading to a runtime error.

Resolution

We have set skipNodeModulesBundle to true in our tsup configuration. This change instructs tsup/esbuild not to bundle the node_modules dependencies. As a result, Node.js handles the resolution and loading of modules at runtime, including the complex loading mechanisms used by jsdom.

Impact

This fix requires jsdom (and any other external module we use) to be installed in the user's project (we already recommend this), as our library now depends on these modules being present at runtime. This approach ensures that all dynamically loaded resources and complex module structures in jsdom are handled correctly by Node.js, preventing similar issues.

Closes EX-975

@jpedroschmitz jpedroschmitz self-assigned this Jan 30, 2024
Copy link

changeset-bot bot commented Jan 30, 2024

🦋 Changeset detected

Latest commit: 8450225

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphcms/html-to-slate-ast Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jpedroschmitz jpedroschmitz merged commit fa2b896 into main Jan 31, 2024
3 checks passed
@jpedroschmitz jpedroschmitz deleted the fix-html-to-slate-ast branch January 31, 2024 14:29
@github-actions github-actions bot mentioned this pull request Jan 31, 2024
@hygraph hygraph deleted a comment from linear bot Jan 31, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Cannot find module './xhr-sync-worker.js'
2 participants