-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
internet.jwt()
fails on documentation website
#3285
Comments
Would be glad if someone can confirm this bug. |
I can confirm the error as well on Firefox For Windows. |
Looks like it's getting poly filled: https://cdn.jsdelivr.net/npm/@faker-js/[email protected]/+esm
|
I already came to the same conclusion in the "Additional Context" section of the issue. Still, I'm unable to grasp why this happens, since we have zero runtime dependencies.. |
Might the bundling from JSDelivery cause trouble? You can see at the top of the /**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/@faker-js/[email protected]/dist/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
[...] I tried the mentioned original file. When I do |
Oh, I haven't seen that part.
Should we replace our import references? |
I guess that would be the best to not rely on downstream implementations. 🤔 |
Yeah. especially since it seems to be stuck for many months now. |
I checked again. The advantage of the |
console.time("bundled")
await import("https://cdn.jsdelivr.net/npm/@faker-js/[email protected]/+esm");
console.timeEnd("bundled")
console.time("original")
await import("https://cdn.jsdelivr.net/npm/@faker-js/[email protected]/dist/index.js");
console.timeEnd("original") Mostly:
Sometimes:
|
We could push a single file build onto our website and use that instead of an external source ( Might be useful in combination with: |
Lets discuss this issue on thursdays team meeting. Since this issue is only present on the website if you are using functions that call the internal base64-helpers, the scope of this bug is pretty limited. If you think this is more urgend, feel free to provide a PR with your suggestion of a fix. |
looks like there may be a way to stop jsdelivr adding the Buffer polyfill: |
Not urgent as no users have reported this error yet. This might also affect users that bundle faker into production code for whatever reason and applying the partial polyfil. So the neat trick with node:buffer=false might be worth applying anyway. I consider the browser self bundling a separate feature. |
Team Decision
|
Pre-Checks
Describe the bug
When running
faker.internet.jwt()
on our documentation site, you receive an runtime error:This might affect other browser environments as well (at least the ones using the same CDN).
Minimal reproduction code
Go to https://fakerjs.dev and open the dev tools.
Run the following:
Additional Context
Our check for the existance of
Buffer
fails because the file (https://cdn.jsdelivr.net/npm/@faker-js/[email protected]/+esm) loaded from the cdn includes a Buffer polyfill:Environment Info
Tested in Microsoft Edge - Version 131.0.2903.63 (Offizielles Build) (64-Bit)
Which module system do you use?
Used Package Manager
npm
The text was updated successfully, but these errors were encountered: