Closed jamieomaguire closed 2 months ago
Hi, Same situation here. Additionally I can say that it seem to be unstable (sometimes working, sometimes not). We have several pages in our app, using the same lit component, and in some cases it's working, in other not.
@jamieomaguire I have not tested the module with nuxt generate
at all.
Do you experience the same issue when using generate
in this project itself?
@duduyo Do you have the issue with generate
as well or also with build
?
I have been using this module on prod with our custom Lit component library for a while now. Have not noticed the issue you described.
But, if you mean, with generate
that's a different story.
@duduyo Do you have the issue with
generate
as well or also withbuild
?I have been using this module on prod with our custom Lit component library for a while now. Have not noticed the issue you described.
But, if you mean, with
generate
that's a different story.
Hi, Thank you for your reply (and your job on this module !)
Here are some details on our context : we do not use generate
on our project. We don't have problem on nuxt dev
, but the bug appears while serving the production bundle.
And something strange is that the same lit component works on some pages, and raise this bug on other pages... while we are using exactly the same code.
I've tried a short investigation, and when it comes to an error, the customElements
registry is missing at least one element (it's like the customElements.define() has not been done yet...)
Hope this helps !
@duduyo is it possible to maybe look into your issue together?
Or, if it is easily reproducible in a StackBlitz or something, that'd be great too.
@jamieomaguire I have not tested the module with
nuxt generate
at all.Do you experience the same issue when using
generate
in this project itself?
Sorry @prashantpalikhe, I don't see a generate
command in this package. How would I do this?
@duduyo is it possible to maybe look into your issue together?
Or, if it is easily reproducible in a StackBlitz or something, that'd be great too.
Yes, sure ! I cannot easily reproduce it to stackblitz, but, you can see here an example of the error : https://territoiresfertiles.org/diagnostics/pdf/paris And to reproduce, you can run our app on your side :
npm install
, npm run build -w apps/tef
, npm run serve -w apps/tef
and go to http://localhost:8777/diagnostics/pdf/paris , you should see the errornpm run start:tef
, and go to http://localhost:8777/diagnostics/pdf/paris , you should not see the error (no error on dev mode...)Heya, this appears to be related to a known issue with Nitro. We got around it by adding the individual component packages to our nuxt config 😄
Example nuxt.config.ts
file:
export default defineNuxtConfig({
ssr: true,
nitro: {
moduleSideEffects: [
'@justeattakeaway/pie-assistive-text',
'@justeattakeaway/pie-button',
'@justeattakeaway/pie-card',
'@justeattakeaway/pie-chip',
'@justeattakeaway/pie-cookie-banner',
'@justeattakeaway/pie-divider',
'@justeattakeaway/pie-input',
'@justeattakeaway/pie-form-label',
'@justeattakeaway/pie-icon-button',
'@justeattakeaway/pie-link',
'@justeattakeaway/pie-modal',
'@justeattakeaway/pie-spinner',
'@justeattakeaway/pie-switch',
'@justeattakeaway/pie-tag',
'@justeattakeaway/pie-icons-webc',
],
},
modules: [['nuxt-ssr-lit', { litElementPrefix: ['pie-', 'icon-'] }]],
imports: {
transform: {
exclude: [/\bpie-\b/, /\bicon-\b/],
},
},
css: ['@justeattakeaway/pie-css'],
devtools: { enabled: true },
devServer: {
port: 3002,
},
});
Looks similar to the issue we discussed here
Describe the bug When I use this package in a Nuxt 3 app, a
yarn build
command succeeds however ayarn generate
results in a number of Lit rendering errors. I am just curious to know if the SSG command is expected to succeed with this package?Example of the output after running
yarn generate
:To Reproduce
It is probably easier to look at how I have added our Lit component library to my project rather than reproduce. All the changes are in the
nuxt-app
directory in the PR.Expected behavior The generate command to succeed
Screenshots