Unable to set global "document" available to imported ts #13717
cryptographix
started this conversation in
General
Replies: 1 comment 1 reply
-
This is not a Deno issue, it has to do with module instantiation order with ES modules. The modules you are importing get instantiated before the module that imports it, meaning the code in the imported module runs before the code in the If you want something like this to work, you need to create something like globalThis.document = {} as any; And then in your import "./globals.ts";
import {
attr,
customElement,
FASTElement,
html,
Observable,
} from "https://cdn.skypack.dev/@microsoft/fast-element?dts"; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am setting
globalThis.document
in mymain.ts
and expected this to be available to imported modules, but get an error when I execute:Is this behaviour correct? Is there another way to inject globals, to implement SSR for example via a simulated DOM?
tsconfig.json:
main.ts:
Beta Was this translation helpful? Give feedback.
All reactions