dotlottie / player-component

https://dotlottie.io
MIT License
206 stars 28 forks source link

Direct import support for nuxt3 #85

Closed jpengelbrecht closed 1 year ago

jpengelbrecht commented 1 year ago

It would be nice if we could use this as a direct import in nuxt3, plugins are added to every page on your website it isn't the performant choice. And the whole point of this technology is performance.

Currently direct imports gives the error At least one <template> or <script> is required in a single file component.

Even currently installed as a plugin it gets the warning. failed to resolve component: dotlottie-player which is supposedly fixed by adding it as a custom component in your complier options, however this gives the same error as using it directly. At least one <template> or <script> is required in a single file component.

so ideally it would be nice if the nuxt3 support would be re-evaluated

samuelOsborne commented 1 year ago

Thanks for your feedback @jpengelbrecht, we are currently evaluating our players and this is useful feedback for when we create a Vue wrapper.

Are you currently able to get this player working for nuxt3 in the mean time?

jpengelbrecht commented 1 year ago

@samuelOsborne yea it actually works pretty nice. it just gives a warning image

samuelOsborne commented 1 year ago

@jpengelbrecht Are you able to get rid of the warning by excluding it as it says?

AndersNielsen85 commented 1 year ago

@jpengelbrecht @samuelOsborne The warning can be suppressed with

export default defineNuxtConfig({
  vue: {
    compilerOptions: {
      isCustomElement: (tag) => tag.startsWith('dotlottie'),
    },
  },
});

It would be really nice to be able to do a direct import though, rather than having to add it globally :)

samuelOsborne commented 1 year ago

Thanks @AndersNielsen85, Yes that would be ideal, we're working on adding player support for the various frameworks so hopefully that'll solve this issue :-)