Loading Third Party Assets with Nuxt Scripts

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 39

  • @TheAlexLichter
    @TheAlexLichter  2 місяці тому +15

    Wanna give Nuxt Scripts a try?

    • @robg.4213
      @robg.4213 2 місяці тому

      Since Nuxt Scripts is in beta status - is it mature enough to use in production? Are there lots of changes to be expected?

  • @thetakburger7928
    @thetakburger7928 2 місяці тому +1

    This channel is the best way to get updated and sold on the new features of nuxt. This looks great.
    I’d love on those videos that you talk a bit about the security (especially of api keys, it’s always the little worry that creeps around)

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      Trying my best to keep you up to date on them 🙌
      I've covered the API key topic in my very first video (ua-cam.com/video/2tKOZc3Z1dk/v-deo.html) - is there anything missing from your POV which I should cover besides that?

    • @thetakburger7928
      @thetakburger7928 2 місяці тому

      @@TheAlexLichter hadn’t see that video ! It’s a good one.
      In the rendering modes video, I wondered if some rendering modes would change the readability of an api key that’s not public. I also wondered if there was a way to hide a non public key in a plugin to avoid creating an api layer (though now I don’t see the use case for that scenario)

  • @neonbyte1337
    @neonbyte1337 2 місяці тому +3

    Perfectly for every web developer living in Europe

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому +1

      I'd even go further and say for all of them. Perf and privacy gains help us all 💚

  • @Klickflip
    @Klickflip 2 місяці тому

    That thumbnail though. Fits the „let’s dive right into it“

  • @chstappert
    @chstappert 2 місяці тому

    Great. Would have bet for this topic to be covered from you this week ;-). I saw it first in vuejs amsterdam. Great to know that I can use it now in my projects.

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      Oh yes, indeed. The first announcement was earlier this year - really happy that it is out now 🎉

  • @Saeid-Za
    @Saeid-Za 2 місяці тому

    Would calling load function multiple times have any side effects? Or would it be just a NOOP ?
    I used to manually store the now deprecated $script promise and would return if fhe script was not loaded yet, to prevent duplicate loading of script.
    Would this new approach suffice this kind of use case?
    Thanks for the video! ❤

  • @randomtimessomehow
    @randomtimessomehow 2 місяці тому

    That's nice! But lets take Hotjar as an example. There is a Hotjar Nuxt Module available. Should I rather use useScript or the available module? Do Nuxt modules (usually) use useScript under the hood?

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      As Nuxt Scripts is rather new, most modules won't support Nuxt Scripts at the time of writing. I see two ways there though:
      1) If the module is doing not much on top besides configuration + loading the script, a nuxt/scripts registry script would be the way to go and the module wouldn't be needed
      2) If the module does more beyond that (think of e.g. setting up a custom configuration, adding plugins and so on), then the module should use Nuxt/Scripts at some point 👍

  • @danielkelly2585
    @danielkelly2585 2 місяці тому +1

    instead setting up the trigger option, could we alternatively add @mouseover to the h1 and call the de-structured load function on mouseover? ie is the trigger config option doing anything additional/magical that I should be aware of?

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      Yes, you absolutely could! This is more for convenience 😊
      The util is also more interesting if you use `trigger: 'visible'` (instead of rolling your own intersection observer), or even a combination of possible triggers

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      Link to the implementation of useScriptTriggerElement
      github.com/nuxt/scripts/blob/99626a261e26982101b92129eb833ffef9853967/src/runtime/composables/useScriptTriggerElement.ts#L49-L72

    • @danielkelly2585
      @danielkelly2585 2 місяці тому

      @@TheAlexLichter oh nice! Thanks! Visible makes perfect sense. For the mouseover using the vue event listener seems more idiomatic to me

  • @MdMasudRana-e2k
    @MdMasudRana-e2k 2 місяці тому +1

    thanks bro

  • @adetayoadeyemi4350
    @adetayoadeyemi4350 2 місяці тому

    hey Alex, looking for ideas on the best way to write test for the server folder in Nuxt

  • @mahsamiiiir
    @mahsamiiiir 2 місяці тому +1

    Hi Alexander, If it's possible, please make a video tutorial about nested dynamic route I mean like this: /categories/slug/slug to display like this: /categories/car/ferarri

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому +1

      Sure! What would you like to know about nested dynamic routes?

    • @mahsamiiiir
      @mahsamiiiir 2 місяці тому +1

      @@TheAlexLichter I want to two slugs alongside together in route like this: /product-categories/slug/slug

  • @danghanquan
    @danghanquan Місяць тому

    nuxt scripts seem like complicated structure to write the code. I am still so much confuse after watch the docs and see youtube video told about nuxt scripts. But after saw your video I have a bit understand not all. Thanks for the video tutorials about the nuxt scripts.

    • @TheAlexLichter
      @TheAlexLichter  Місяць тому

      What was shown here is more of a custom use case. Using a repository script is more straightforward (but IMO it is great it allows so much flexibility)
      You are welcome! 👌

  • @WebDevRef
    @WebDevRef 2 місяці тому

    No need to use partytown anymore?

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому +2

      Different use case. Scripts in a web worker still won't block the main thread. It is also on the roadmap for nuxt scripts github.com/nuxt/scripts/issues/182

    • @WebDevRef
      @WebDevRef 2 місяці тому

      @@TheAlexLichter Great, thx!

  • @QueeeeenZ
    @QueeeeenZ 2 місяці тому +2

    Too many things are called "run"

    • @TheAlexLichter
      @TheAlexLichter  2 місяці тому

      Yes, that's true 🙈
      Though everything except the `run: displayWidget` is the same "run"

  • @ivanangelkoski
    @ivanangelkoski Місяць тому

    im making a vue widget in vite which builds a js script, and i want to use it in a nuxt project, but whenever i import the script the HMR on the nuxt app stops working... any hints why this may be?
    is it maybe because Vue from the script is somehow interfeering with Vue from Nuxt? also if you have any tips for creating widgets in vue, that would be great!

    • @TheAlexLichter
      @TheAlexLichter  Місяць тому

      Difficult to say without a reproduction I'm afraid :/

  • @Filipp1139
    @Filipp1139 5 днів тому

    Why nuxt has low attention.. :(

    • @TheAlexLichter
      @TheAlexLichter  4 дні тому

      Good question! I think there are *a lot* of people using Nuxt already but especially people in the React ecosystem rarely look "outside of it" :/

  • @etorres1193
    @etorres1193 2 місяці тому +1

    This module is awesome