Closed kettanaito closed 5 months ago
Since #471 is closed now, I am adding the comment here as well:
Using node:crypto
would break browser compatibility. As far as I know msw uses this package to defer requests until the service worker has been registered, so browser compatibility is still needed.
Using crypto.randomUUID()
work on https-sites, but cannot be used on http-sites, because crypto
is undefined
there.
@hpohlmeyer, thanks for the context around the pull request.
Using node:crypto would break browser compatibility.
True. However, both Node.js and browsers ships a global crypto
object that has the .randomUIUD()
method. This code runs the same in the browser and in Node.js:
crypto.randomUUID()
We don't need to import node:crypto
at all!
Using crypto.randomUUID() work on https-sites, but cannot be used on http-sites, because crypto is undefined there.
This is out of the scope of this package. None of the interceptors are meant to be deployed to production. I don't treat this as a blocker.
This has been released in v0.26.12!
Make sure to always update to the latest version (npm i @mswjs/interceptors@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
Node.js ships with the built-in way to generate UUID via the
node:crypto
module. We should remove theuuid
dependency and usenode:crypto
instead.