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

fix: remove node.js dependency in browser #1081

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

himself65
Copy link

@himself65 himself65 commented Feb 7, 2025

Description

Node.js core modules are imported in client(browser) side. And the previsous code use node polyfill, however this would brings more issue:

  1. node:buffer, node:zlib... where node: as prefix would still break the webpack bundler because node-polyfill-webpack-plugin didn't handle it correctly
  2. node polyfill packages are mostly too outdated (many years no updates)
  3. indirectly import Buffer could leads unexpected behavior

This PR remove node.js dependency, instead now uses pika and web api directly to reduce the bundle hack, bundle size and more explicit imports

Motivation and Context

For more context, docusaurus will raise error if use nolyfill

telegram-cloud-photo-size-5-6138468470803777616-y

How Has This Been Tested?

Try this in demo and everything works

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

Copy link

github-actions bot commented Feb 7, 2025

Visit the preview URL for this PR (updated for commit 2e73145):

https://docusaurus-openapi-36b86--pr1081-lq3u8386.web.app

(expires Thu, 13 Mar 2025 18:43:09 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
Copy link
Member

sserrata commented Feb 7, 2025

Hi @himself65, thanks for the PR...there seems to be some issues with CSR:

On initial load and route change I'm not getting past the loading skeletons:

Screenshot 2025-02-07 at 2 23 03 PM

@himself65
Copy link
Author

Hi @himself65, thanks for the PR...there seems to be some issues with CSR:

On initial load and route change I'm not getting past the loading skeletons:

Screenshot 2025-02-07 at 2 23 03 PM

thanks for checking. I see there is a process somewhere, let me check

Copy link
Collaborator

@blindaa121 blindaa121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @himself65! For context, I believe the polyfill package was initially added to provide support for our postman library (see #422). Since this package has since been removed from the project, I think your solution should be good to go.

@sserrata Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants