-
Notifications
You must be signed in to change notification settings - Fork 7
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
SSR Nuxt 3 customElements.get error #137
Comments
@kevinrodrigues Hey there, I can have a look later. But my hunch is that the component is stripped away from the server build. If you can already look in that direction, that would be great. Make sure your link/button components' code are loaded on the server too. |
@kevinrodrigues If you add this to the nuxt.config.ts nitro: {
moduleSideEffects: ['@justeattakeaway/pie-link', '@justeattakeaway/pie-button'],
}, Everything works. Not sure why your imports are being stripped off in the server build though. Maybe the sideEffects configuration in the package.json for your component packages need to be configured differently? |
Sorry for the delay. I will take a look at this config change today. I'm not sure either why our components could be stripped but ill take a look at our individual components too. Ideally i'd want the component to be configured correctly instead of adding this setting in for all components as I'd have to add each component to the Thanks alot for taking a look at this! |
@kevinrodrigues No worries. I will leave this open until we get to the bottom of this :) Let me know what you find. |
@prashantpalikhe So i've had a play around and it works in our mono-repo with the Removing this setting from the |
Alright, I will close this issue then. |
Describe the bug
I'm using the
nuxt-ssr-lit
package in a repo (Nuxt 3) and have followed the implementation guidelines. While using this in SSR mode I seem to get errors. When it is not in SSR mode then it runs and serves a page up fine. I've tried quite a few different things and then decided to build a separate standalone reproduction to see if it was related to our setup or if it was something else. The standalone project also has the same issue. The error message is shown in the screenshot below and there is a also a link to the issue codewise. Would appreciate if anyone with the same issue may have experienced this and has a solution or workaround for this.To Reproduce
Steps to reproduce the behavior:
yarn build && yarn preview
Expected behavior
There should be no error when SSR is enabled inside of the
nuxt.config.ts
file (line 3).Screenshots
Additional info
I have noticed if I do not render a web component within the
layouts
directory (default.vue
) and at thepages > index.vue
we still get the error but on a second page refresh the component renders (the error duplicates in terminal every time you refresh the page though but the component does render in the browser). Seems related to the plugin but I am unsure why at those levels it errors but removing components at those specific levels on second refresh renders something. Steps below to reproduce it:app.vue
comment out the<NuxtLayout>
wrapper (which contains a web component -<pie-link>
).yarn build && yarn preview
<NuxtLayout>
code and rebuild then refreshing the page on second refresh wont render anything again.The text was updated successfully, but these errors were encountered: