If no components are used in the Nuxt app, but component definitions are imported in a plugin (mode: 'all'), the dom-shim does not get applied.
This happens because the imports from LitWrapperServer are removed in the final output generated by Nuxt for the server. (.nuxt/dist/server/server.mjs) if no Lit components are being used. But if those component definitions are being imported in a plugin e.g. import "@acme/button". This will fail because the dom shim has been removed by Nuxt.
To Reproduce
Steps to reproduce the behavior:
Create a Nuxt application that uses the module
Create a Lit component
Import the Lit component definition in a universal Nuxt plugin
Describe the bug
If no components are used in the Nuxt app, but component definitions are imported in a plugin (mode: 'all'), the dom-shim does not get applied.
This happens because the imports from
LitWrapperServer
are removed in the final output generated by Nuxt for the server. (.nuxt/dist/server/server.mjs
) if no Lit components are being used. But if those component definitions are being imported in a plugin e.g.import "@acme/button"
. This will fail because the dom shim has been removed by Nuxt.To Reproduce
Steps to reproduce the behavior:
https://stackblitz.com/edit/nuxt-starter-jpzrrq?file=nuxt.config.ts
Expected behavior
Nuxt application should not break.