Closed kentasaito closed 1 year ago
I understand that "Dynamic imports that are not statically analyzable don't work.", but I'm talking about "statically analyzable dynamic imports".
I tried the example in the article below. https://deno.com/deploy/changelog#2023-07-03 - Statically analyzable dynamic imports
import { serve } from "https://deno.land/std@0.192.0/http/server.ts"; serve(async (req: Request) => { const uuid = "https://deno.land/std@0.192.0/uuid/mod.ts"; const { version } = await import(uuid); const ver = version("109156be-c4fb-41ea-b1b4-efe1671c5836"); return new Response(ver); });
It works in the CLI, but in the playground the following error occurs.
gcp-asia-northeast1TypeError: module not found: 'https://deno.land/std@0.192.0/uuid/mod.ts' at async Server.<anonymous> (file:///src/main.ts:5:23) at async Server.#respond (https://deno.land/std@0.204.0/http/server.ts:305:18) { code: "ERR_MODULE_NOT_FOUND" }
Run the above code in the Playground.
The module will be imported and then "4" will be shown.
Deno PlayGround (The error occurs.)
For your reference: deno 1.37.2 (It worked.)
No response
When written as follows, the expected behavior will occur.
import { version } from "https://deno.land/std@0.192.0/uuid/mod.ts";
When I opened the same Playground again without making any changes, the expected behavior (a "4" was displayed) occurred.
Problem description
I understand that "Dynamic imports that are not statically analyzable don't work.", but I'm talking about "statically analyzable dynamic imports".
I tried the example in the article below. https://deno.com/deploy/changelog#2023-07-03 - Statically analyzable dynamic imports
It works in the CLI, but in the playground the following error occurs.
Steps to reproduce
Run the above code in the Playground.
Expected behavior
The module will be imported and then "4" will be shown.
Environment
Deno PlayGround (The error occurs.)
For your reference: deno 1.37.2 (It worked.)
Possible solution
No response
Additional context
When written as follows, the expected behavior will occur.