Replies: 1 comment
-
So I kinda progressed on the issue by moving all the markup to the root instead of the page, which I assumed means, in SPA mode context, that an entirety of the page is rendered on server first. But then I get a bunch of hydration errors, which is expected, since the offending scripts modify the markup before the first react render. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a vanilla
index.html
+ a bunch of javascript files it loads like this:The scripts are doing a lot of gnarly vanilla javascript things, including referencing each other's symbols from global scope. They are not ESM-ready at all and rewriting them along with introducing build step with bundling is quite an undertaking.
The first step I took is making it a template file with the root rendering nothing and being hidden, while all other assets are in
public
folder:Now it builds and works as before, however I need the html as a jsx file in order to split into components, so its markup has to be moved into remix rendering tree.
After some fiddling I get these files:
root.tsx
routes/_index.tsx
However, the scripts crash due to trying access
document
object and getting null on its methods.I assume because they run during fallback or before the first react render, but how do I make them run after first render without making them a part of the bundler tree?
Beta Was this translation helpful? Give feedback.
All reactions