Skip to content

Commit

Permalink
fix: add dynamic npm imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Jun 7, 2024
1 parent b6cbe17 commit acc5756
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oak/acorn",
"version": "0.7.0-alpha.3",
"version": "0.7.0-alpha.4",
"exports": {
".": "./mod.ts",
"./context": "./context.ts",
Expand Down
5 changes: 5 additions & 0 deletions http_server_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ export default class HttpServer implements Server {

async listen(): Promise<Listener> {
if (!("Request" in globalThis) || !("Response" in globalThis)) {
// adding this dependencies because for some reason they are picked up
// in undici directly when deploying on CFW, even though they aren't
// actually used at runtime
await import("npm:buffer@^6.0");
await import("npm:string_decoder@^1.3");
const { Request, Response } = await import("npm:undici@^6.18");
Object.defineProperties(globalThis, {
"Request": {
Expand Down

0 comments on commit acc5756

Please sign in to comment.