Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: "client-only" islands. #975

Open
cowboyd opened this issue Jan 9, 2023 · 2 comments
Open

feature request: "client-only" islands. #975

cowboyd opened this issue Jan 9, 2023 · 2 comments

Comments

@cowboyd
Copy link

cowboyd commented Jan 9, 2023

Every once in a while we encounter a module that cannot even be loaded on the server because it has top-level references to browser-only objects such as document. This is the case when you try to use the Monaco editor in Fresh.

Basically it blows up just evaluating the module because it wants to look up DOM nodes at the module's top-level.

"Bad behaving" ES modules that refuse to even load on anything but the browser are a fact of life, and it would be nice if Fresh provided a way to specify a placeholder element for the initial render, but only load and run the code of the island on the client.

I don't know what this would look like, but it saves a lot of pain hand-rolling async imports.

@cowboyd
Copy link
Author

cowboyd commented Jan 9, 2023

It appears that the source of the issue is that vscode has binary logic on whether it is running on Node vs Browser, but thinks that Deno is the browser and so it goes ahead and reaches for document. https://github.com/microsoft/vscode/blob/12e6b0b3043f19d0cf1730eb3c213d3930310053/src/vs/base/browser/canIUse.ts#L21-L23

I filed an issue here microsoft/monaco-editor#3501

@HeavySnowJakarta
Copy link

that's why i've decided to give up deno+fresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants