Closed caleblloyd closed 1 day ago
I think https://github.com/denoland/deno/pull/25140 should fix this.
That is a nice improvement! Unfortunately I do not think that fixes this particular issue though :smiling_face_with_tear: I rebased that PR on deno_core 0.307.0 and added this test case to tests/unit_node/async_hooks_test.ts
:
Deno.test(async function worksWithDynamicImports() {
const store = new AsyncLocalStorage();
(globalThis as any).alsDynamicImport = () => store.getStore();
const dataUrl =
`data:application/javascript,export const data = alsDynamicImport()`;
await store.run("data", async () => {
const { data } = await import(dataUrl);
assertEquals(data, "data");
});
});
and it fails:
[async_hooks_test 005.03] [Diff] Actual / Expected
[async_hooks_test 005.03] - undefined
[async_hooks_test 005.03] + "data"
Version: Deno 1.46.1
AsyncLocalStorage
does not seem to work inside of a dynamic import in Deno, but it does in Node:als.mjs
dynamic.mjs
not working in deno
working in node