NextJS integration tutorial and docs doesn't work #1590
Replies: 8 comments 4 replies
-
Also followed this method with dynamic importing - which worked in |
Beta Was this translation helpful? Give feedback.
-
Some progress: Managed to get the dynamic import approach (provided above) to work. Problem was that Still, could not get the official tutorial method to work, though. |
Beta Was this translation helpful? Give feedback.
-
Hi Cory, I've come across the same issue in a SvelteKit app. It happens when I import Shoelace's I created a repro case here: https://github.com/andrico1234/shoelace-ssr-repro I also created a Loom running through the problem in more detail: https://www.loom.com/share/721320086a7b49f7b9873e0a9ae53642 In short, my solution is to check whether I'm in a browser environment in SvelteKit and then dynamically import the button. Before
After
I also ran the build step and previewed the production bundle with my solution and the button renders as expected. I have a few questions with my workaround:
Thanks for the great library! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I think we are encountering a similar issue like High chart https://github.com/highcharts/highcharts-react#highcharts-with-nextjs ![]() But for us do to use importing many components. It doesn't seen to be a clean solution |
Beta Was this translation helpful? Give feedback.
-
Dynamic import seen to be the solution
![]() |
Beta Was this translation helpful? Give feedback.
-
Working solution with dynamic import The correct way to import shoelace component is next.js
const SlTab = dynamic(
() => import("@shoelace-style/shoelace/dist/react").then(mod => mod.SlTab),
{
ssr: false,
}
) Avoid build issues. |
Beta Was this translation helpful? Give feedback.
-
There's some new docs for NextJS app router here if anyone has a moment and would like to check them out: |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
NextJS integration tutorial doesn't seem to be working. It provides an example repo, which doesn't seem to be working as well.
While trying several configurations, seems like NextJS is running into an error:
So,
MutationObserver
is not available for the Node env.To Reproduce
Steps to reproduce the behavior:
npm i
npm run dev
Screenshots
Browser / OS
Beta Was this translation helpful? Give feedback.
All reactions