Replies: 2 comments
-
|
Sigma needs a DOM, so it has to live in an island — the setup looks right but Sigma's npm build also ships browser-only globals. Add |
Beta Was this translation helpful? Give feedback.
-
|
I think the main issue is that the island only solves part of the problem. Fresh islands still get rendered on the server first, so if What worked for me in similar cases is moving the browser-only imports into This is "TypeScript Code": import { useEffect, useRef } from "preact/hooks"; export default function SigmaGraph() { useEffect(() => { }, []); return ( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is not an issue with Fresh, forgive my ignorance of ssr, vite, etc...
I am trying to get a simple example such as this working:
Which I imagine should go into an island file with a simple preact wrapper like:
In deno.json I have these import entries:
The issue is the Graphology import throws errors in the island for apparent babel / node style imports and the Sigma import throws errors because it has browser only deps that should only be accessed behind IS_BROWSER. I have tried placating the vite's dismissal of the Graphology import with node polyfills, but only came up with a plethora of other errors and dynamically importing Sigma after IS_BROWER but got "TypeError: Failed to fetch dynamically imported module" with what looks like a valid path to the node_modules package. I can import Graphology in an api file, so I began scheming on doing the graph work there and passing a serialized result downstream or including simple cdn imports in the app html template and somehow accessing them, but before I go down any ratholes, wanted to check here first, as I feel I am fundamentally missing how Fresh and ssr work, as it shouldn't be this difficult to get started... Thanks for any advice or links to RTFM.
Beta Was this translation helpful? Give feedback.
All reactions