Page is not hydrated after dynamic import #10908
Replies: 3 comments
-
For anybody else looking for how to add custom elements/web components to Nextjs. I tried the following and it works without dynamic import.
|
Beta Was this translation helpful? Give feedback.
-
Hi @secretlifeof! - the |
Beta Was this translation helpful? Give feedback.
-
Hi @developit - Thank you for having a look. The sandbox above does not use @zeit/next-preact. Just plain Nextjs and Preact inside a custom element. I saw your sample repo a week ago and am grateful that you created that, but sadly that also does not work. This time there seems to be a continuous loop crashing my browser tab. Please look at the following repo: https://codesandbox.io/s/github/secretlifeof/nextjs-preact-demo-custom-element-not-loading |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
Describe the bug
I am trying to import a custom element written in Preact using dynamic import. The custom element is loaded into the DOM but the page does not seem to get hydrated.
To Reproduce
If you open the sandbox the page gets loaded, but it should print "mounted" in the console. It should also console if you Click on "Click me".
https://codesandbox.io/s/nextjs-dynamic-import-issue-ylvsy
Expected behavior
Loading custom and javascript gets hydrated without errors.
System information
Preact: 10.3.3
React: 16.13.0
How do you recommend loading an external custom element inside a .js/.ts file?
Beta Was this translation helpful? Give feedback.
All reactions