Doing JavaScript Imports 2019 Style - I love this approach!

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 78

  • @andreicucea
    @andreicucea 5 лет назад +6

    bootstrap.js 3064 bytes

    • @aerotwist
      @aerotwist  5 лет назад +1

      Did you check out the code? 😂

    • @andreicucea
      @andreicucea 5 лет назад +2

      @@aerotwist of course :)

  • @dassurma
    @dassurma 5 лет назад +5

    You are just jealous of my mad 90s naming skillzzz0rz.
    For all ya folks watching: The reason I wrote loadz0r is so that y’all can use all your beautiful modules in workers too!
    github.com/surma/rollup-plugin-loadz0r
    #shamelessPlug

    • @aerotwist
      @aerotwist  5 лет назад

      If I hadn't agreed to pin something else, I'd pin this. But I can't. So I won't.

  • @samfrostinjapan
    @samfrostinjapan 4 года назад

    Your videos are great. You're quickly becoming my favorite source of knowledge for front end development techniques.

  • @SiddiqNx
    @SiddiqNx 5 лет назад +2

    Man, you are so enjoyable to watch! Thank you for the videos and keep doing the great work!

  • @KevinSheppard
    @KevinSheppard 5 лет назад +8

    "What's your problem, TypeScript?" - Me every 5 minutes using TypeScript.

    • @aerotwist
      @aerotwist  5 лет назад +3

      It _does_ get easier, you just pay the cognitive cost at author time instead of runtime, bugs notwithstanding

    • @KevinSheppard
      @KevinSheppard 5 лет назад

      @@aerotwist TBH I've given up on Typescript for now. I'll probably come back in a couple years.

    • @LosEagle
      @LosEagle 5 лет назад

      That's kind of the point of TS though. It warns you about things so you don't have to deal with them after the code is pushed on production.

  • @אלייארונובסקי
    @אלייארונובסקי 4 года назад

    How do you prevent spamming the buttons, basically if a user click the button 100 times the script gets imported again. what would be the best practice for this?

  • @ChrisPizzinato
    @ChrisPizzinato 5 лет назад

    Great video and good to have you back! Really digging the new atmosphere!

  • @JoshuaVanAllen
    @JoshuaVanAllen 5 лет назад

    I'm glad I'm not the only one that sometimes has to just restart VSCode to get rid of errors!

  • @markusstaab2506
    @markusstaab2506 5 лет назад

    the approach described requires typescript to be configured as 'esNext' (as shown in the video) or 'commonjs' (because of dynamic imports).
    could you desribe how the setup looks like in case I need to target older browsers, like IE11 etc.?
    (maybe in a separate video)

  • @chrsbll
    @chrsbll 5 лет назад

    Great technique, and very well explained. Welcome back.

  • @dominikdeimel9486
    @dominikdeimel9486 5 лет назад

    So glad your back! And awesome video! Like always

  • @avilde
    @avilde 5 лет назад +2

    loadz0r :D. @Surma, what was the thought process here?
    bootstrap.js 3379.2 bytes? (guessing from the network panel)
    paulLewis.ts
    ...
    export { goodBRoll, goodMusic, goodJokes, theBeard };

  • @hypersonic12
    @hypersonic12 5 лет назад

    Funny, was expecting it to spit out actual ECMAScript dynamic imports at the end! Looking forward to getting rid of all the dynamic loading boilerplate in a couple years when browser and tooling support is there.

    • @aerotwist
      @aerotwist  5 лет назад

      Would be awesome, but I wonder if we will get there

  • @simoneicardi3967
    @simoneicardi3967 5 лет назад

    Doesn't webpack do something similar?

  • @davatron5000
    @davatron5000 5 лет назад

    Love the ombré lighting!

    • @aerotwist
      @aerotwist  5 лет назад

      I had to Google that...

  • @DivjotSingh
    @DivjotSingh 5 лет назад +2

    Instead of reloading VSCode you can also just restart TypeScript server. Much faster

  • @neildawson6274
    @neildawson6274 5 лет назад +5

    You're gonna need to play that bass some day soon...

    • @aerotwist
      @aerotwist  5 лет назад

      Hahaha.... No. Nobody wants a 40 minute bass solo, you know that, Neil ;)

    • @danpetitt497
      @danpetitt497 5 лет назад

      Paul Lewis I dunno, I would happily listen to a Mark King (Level 42) slap solo any day

  • @andresgutgon
    @andresgutgon 5 лет назад

    Welcome back, glad to see you :)

  • @OutlawAndy
    @OutlawAndy 5 лет назад

    I really want to like VSCode, but my experience has been that it complains incorrectly so often that I end up either completely distracted from what I'm trying to accomplish or I end up ignoring things that I've actually mistyped. You clearly have a much higher pain tolerance than I do, for this sort of issue.

    • @aerotwist
      @aerotwist  5 лет назад

      I don't, actually. Generally I've found it very well behaved. I don't really have any extensions or anything.

  • @AtanasShtrankov
    @AtanasShtrankov 5 лет назад

    Great to see you back :)

  • @bartverduijn449
    @bartverduijn449 5 лет назад

    Welcome back Paul!

  • @venus9598
    @venus9598 5 лет назад

    Welcome back!!!

  • @mayanknxder
    @mayanknxder 5 лет назад

    Nice Video as always! btw "Quick Fix>Show documentation for x" will take you to the explanation of the error.

    • @aerotwist
      @aerotwist  5 лет назад

      I figured what it was in this case; I'd had a branch open previously with a function of that name and VSCode got itself in a funny state. No amount of reveals would have helped, sadly, as the code was not in the checkout.

  • @johncreativeproducts5688
    @johncreativeproducts5688 5 лет назад

    HELL YEAAAHH PAUL LEWIS IS BACK!!!! 🤘

  • @marcorieser
    @marcorieser 5 лет назад

    What's the music at the end of the video?

  • @SAS-qq5ce
    @SAS-qq5ce 5 лет назад

    Finally !!!!! Missed u a lot man

  • @oleksandrkozlov4195
    @oleksandrkozlov4195 5 лет назад

    Good video :) I think you showed bootstrap.ts in your network panel in Development menu. 3300 bytes, no?

    • @aerotwist
      @aerotwist  5 лет назад

      Is that an official guess? ;)

  • @jenishngl
    @jenishngl 5 лет назад

    A nice video after a long time :)
    If you are taking requests for making videos, can you do a video on "How do you handle authentication on WebApps?" please

    • @aerotwist
      @aerotwist  5 лет назад +1

      I'll have a think on that one...

  • @jonathanfeldman7309
    @jonathanfeldman7309 5 лет назад

    Don't the dev tools say the bootstrap.js file is 3.3 kb? I'm going to guess 3324 bytes. Or are you looking for the bytes after minification and gzipping? Great video by the way!

    • @aerotwist
      @aerotwist  5 лет назад +1

      I'm looking for the size of bootstrap.js in dist as reported by the OS

  • @zeocamo
    @zeocamo 5 лет назад

    no vim bindings ... ??? why ?? paul are you not coding for a liv'ing ?

    • @aerotwist
      @aerotwist  5 лет назад +1

      I never really bothered to learn them :)

    • @aerotwist
      @aerotwist  5 лет назад +1

      And yes I code for a living

  • @AnantoGhosh
    @AnantoGhosh 5 лет назад

    Nice to see even Paul facing stupid errors and not just me. You could directly restart the typescript server from the command menu. (I've had to use it a lot (sad face)).

    • @aerotwist
      @aerotwist  5 лет назад +1

      Yeah I leave these things in because they happen to us all.

  • @stephenjames2951
    @stephenjames2951 5 лет назад

    Curious. Where in the UK is your accent from?

    • @aerotwist
      @aerotwist  5 лет назад

      The north. About 40 minutes north east of Manchester. Heavily adjusted by living in different places during my childhood.

  • @BhargavaMan
    @BhargavaMan 5 лет назад

    RUclips recommendations really do work sometimes.

  • @r-i-ch
    @r-i-ch 5 лет назад

    Oh! The Surma shade.... :D

    • @r-i-ch
      @r-i-ch 5 лет назад

      (Though...yaknow... Not disagreeing about the name.)

    • @aerotwist
      @aerotwist  5 лет назад +1

      I love him dearly... He just shouldn't name plugins.

  • @cunningham.s_law
    @cunningham.s_law 5 лет назад

    there is a vscode command to restart the typescript server

    • @aerotwist
      @aerotwist  5 лет назад

      Yeah easy once you know that's the issue

  • @superchillh3o
    @superchillh3o 5 лет назад

    I love this video, and the B-Roll is quite wonderful.
    I also had a similar issue with typescript, and fixed it using the command in VS Code " Typescript: Select Typescript Version..." and selecting the workspace version.. perhaps useful in this case, *shrug*, anyways thanks so much for the vids!

  • @biliyonnet
    @biliyonnet 5 лет назад +1

    why are not you use just -Infinity or Infinity instead of Number.(NEGATIVE|POSITIVE)_INFINITY?

    • @aerotwist
      @aerotwist  5 лет назад

      Because both work?

    • @biliyonnet
      @biliyonnet 5 лет назад

      @@aerotwist less code might be more pure i think.

  • @sonicpawnsyou
    @sonicpawnsyou 5 лет назад

    > "Imports 2019 Style"
    mfw still no .mjs :c

  • @Laek4
    @Laek4 5 лет назад

    *feeling deeply frustrated*
    :P

  • @paxdriver
    @paxdriver 5 лет назад

    This is why I refuse to switch to ts lol eff that mate

  • @GodOfMacro
    @GodOfMacro 5 лет назад

    I really enjoy your content it's very high quality (music was not of my taste in this episode and distracted me a bit)

    • @aerotwist
      @aerotwist  5 лет назад

      What kind of music do you like?

    • @GodOfMacro
      @GodOfMacro 5 лет назад

      ​@@aerotwist Personally anything not to flashy, chill enough to not capture my attention, some lofi beats maybe, or just some music in the intro, your voice and personnality are bright and energetic, I dont feel like any music is needed.

  • @Peptou
    @Peptou 5 лет назад

    3064 bytes

  • @jimfoley2690
    @jimfoley2690 3 года назад

    Pure developer gold..... turn it off ....... wait 30 sec and turn it on .....

  • @andrevenancio
    @andrevenancio 5 лет назад

    Its hard to understand why people who use typescript at the same time advocate to use it and also have silly unexplainable errors they would not have otherwise😂 its like u in a bad relationship. just get out of it Paul, you deserve better 😂

    • @aerotwist
      @aerotwist  5 лет назад

      This was a rare outage. Most days I have nearly no problems at all. And for the work I do it's very handy.

    • @andrevenancio
      @andrevenancio 5 лет назад

      Paul Lewis yeah i get it, i was trying humor. failed miserably ;)

  • @filipbruunbech-larsen7053
    @filipbruunbech-larsen7053 5 лет назад

    3064 bytes