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

Change require "url" to "node:url" did make it incompatible with usage inside browser / web #82

Closed
2 tasks done
alexander-schranz opened this issue Jun 4, 2024 · 5 comments · Fixed by #83
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@alexander-schranz
Copy link

alexander-schranz commented Jun 4, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

Plugin version

2.3.0

Node.js version

v14.21.3

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

12.7.4

Description

The changes in 6c97e35

seems to break packages which using it as example via webpack in the browser. I'm not 100% sure if this package was created to work inside browser but thought I would report it if it should.

Currently because of node:url the ajv is failing now which is package used for json schema validation in some cases as we in @sulu using it in browser: ajv-validator/ajv#2446

Link to code that reproduces the bug

ajv-validator/ajv#2446

Expected Behavior

Should work inside the browser / web apps compiles with webpack 4 / 5.

Workaround

For all coming from ajv-validator/ajv#2446 you can downgrade ajv to a version not using fast-uri:

npm install "[email protected].*" --save

or downgrade fast-uro to:

npm install "[email protected].*" --save
@alexander-schranz alexander-schranz changed the title Change url to node:url did make it incompatible with usage inside browser Change require "url" to "node:url" did make it incompatible with usage inside browser Jun 4, 2024
@alexander-schranz alexander-schranz changed the title Change require "url" to "node:url" did make it incompatible with usage inside browser Change require "url" to "node:url" did make it incompatible with usage inside browser / web Jun 4, 2024
@LucasLopesr
Copy link

same problem here

@Eomm
Copy link
Member

Eomm commented Jun 4, 2024

Thanks for reporting!
Would you like to send a Pull Request to address this issue? Remember to add unit tests.

It would be great to solve the add browser stack todo item

@Eomm Eomm added the bug Something isn't working label Jun 4, 2024
@alexander-schranz
Copy link
Author

alexander-schranz commented Jun 4, 2024

@Eomm what ist your recommended solution. Should we just revert #69, or do you have anything else in mind?

And do you have any hint how we can add a test to check if it works inside browser?

@gurgunday
Copy link
Member

Please remove to URL import altogether and make it use the global variable

gurgunday added a commit to gurgunday/fast-uri that referenced this issue Jun 4, 2024
gurgunday added a commit that referenced this issue Jun 5, 2024
@gurgunday
Copy link
Member

I think there is still some work needed to do before we can make fast-uri run on the Web:

#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants