Skip to content

Conversation

himself65
Copy link
Contributor

@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.

@github-actions
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
Contributor 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?

@sserrata
Copy link
Member

To clarify, node-polyfill-webpack-plugin was introduced as a convenient way to avoid defining specific loaders for modules no longer present in Webpack 5.

Our theme still relies on both the postman-code-generators and postman-collection libraries, although it's possible later updates to these libraries could have reduced or changed the need to define those loaders (e.g. url, process, etc.). We moved from forked to canonical versions of both libraries in #861.

@himself65 thanks for the work on replacing my use of zlib with the browser-ready pako! So far it appears to function as intended.

@sserrata sserrata merged commit a86e203 into PaloAltoNetworks:main Feb 19, 2025
9 checks passed
@himself65 himself65 deleted the himself65/2024/02/07/fix branch March 10, 2025 14:07
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