Exporting a custom element from a nuxt3 project

Hello, I'm trying to combine two projects. One is a Nuxt 3 project, the other is a Vue3 project. The Vue3 project uses a vite library build to export a few custom elements. I have copied these into the Nuxt project and got them working as part of the site, but I can't work out how to export them as custom elements, using a library build or similar.

Has anyone done this with Nuxt? Any pointers on what to do?

    build: {
      lib: {
        entry: [
          resolve(__dirname, 'components/viewer/viewer.ts'),
        ],
        fileName: (format, entryName) => {
          return `${entryName}.js`
        },
        name: 'Viewer',
        formats: ['es'],
      },
    },


I tried something like this in my vite config inside nuxt.config.ts (it works in the Vue project) but I couldn't get it to work.
Was this page helpful?