e3181c2d77
This commit allows the users to import URLPattern from `next/server`, by defining a key that uses `global.URLPattern`. Why is this any good? or: why don't we add URLPattern to the global namespace? URLPattern is exposed as global on Edge Runtime _only_. This means that if we define a constructor in global namespace in our TypeScript definitions, people might have runtime errors in their Node.js functions. Importing from `next/server` enables users to get the constructor without risking in runtime errors and wrong type definitions. Keep in mind, that with the current implementation, we do not check if the constructor actually exists, but `next/server` shouldn't be imported in Node.js functions, AFAIK. ## Related - Fixes #38131 ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
1 line
51 B
JSON
1 line
51 B
JSON
{"main":"../console.js","types":"../console.d.ts"}
|