How To Import and Export Modules in Node.js Tutorial

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

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

  • @silverzprogrammer894
    @silverzprogrammer894 3 года назад +10

    you can add "type" : "module" into your package.json file and add .js at the end of the imported file :) you dont need papel

    • @rudya.hernandez7238
      @rudya.hernandez7238 3 года назад

      in versions of node > v13

    • @aniworld4963
      @aniworld4963 11 месяцев назад

      Muito obrigado
      Nao sei se irás perceber o q digo
      mais foste muito simples e directo
      Obrigado ajudaste muito

  • @MrTabasham1990
    @MrTabasham1990 2 года назад +1

    Thanks for getting straight to the point.

  • @robwhitaker8534
    @robwhitaker8534 3 года назад +1

    Awesome, this is the video I didn't know I was looking for that cleared a lot up!

  • @NiharMakwana-pj9ll
    @NiharMakwana-pj9ll Год назад +1

    Thanks for the help sir. I was stuck on these for hours. Last time i set up a project simple "esm" package worked but this time it was not working. This video was both helpful and a nice learning experience :)

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

    that intro song has to be the most badass thing a CS youtuber has ever done. Literally turned off my music to jam out. (1 min into the tut seems good tho)

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

      not what I was looking for but I hope u have a good day

  • @jacquesoberholzer7803
    @jacquesoberholzer7803 Год назад

    The last 1 minute and 58 seconds solves the problem I've had for the past 30 minutes. If that isn't called programming, I don't know what is xD

  • @pablocorleone880
    @pablocorleone880 3 года назад +1

    This was so helpful. Thank you so much! :D

  • @roasted_boy6213
    @roasted_boy6213 4 года назад +1

    thanks james sir for this video hope your are good!!!! Love from India!!!!!!!

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

      Thanks Heramb! Glad you found it useful. Wherabouts in India are you from?

    • @roasted_boy6213
      @roasted_boy6213 4 года назад +1

      @@codewithbubb i am from mumbai sir

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

      Ah cool, the last company I worked for had a big office there.

    • @roasted_boy6213
      @roasted_boy6213 4 года назад +1

      @@codewithbubb ohh nice basically i am student who just started with backend programming and was little bit confused again thanks for your helpful video !!!!!

  • @astarothblu3977
    @astarothblu3977 3 года назад +1

    Thanks, this video was great for me.

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

      Great! Glad you found it useful 😄

  • @adante407
    @adante407 4 года назад +4

    Do you think its not worth learning PHP anymore James? Is Node the way forward? It seems like there is so much more to do with Node, and so many complexities that are taken care of in Frameworks like Laravel?

    • @codewithbubb
      @codewithbubb  4 года назад +4

      Hi John. yes I definitely think PHP is worth learning - to what degree you become proficient in it depends upon your goals.
      For example, if you're going to be a Wordpress developer or work with other open source platforms (Magento, Drupal etc.) then PHP is essential. Laravel and other similar PHP frameworks are also popping up on Job boards more often (at least in my local area).
      Node.js feels a bit more flexible for me in terms of what you can achieve in a short amount of time plus you have npm which has a solution for everything. But yes, the JavaScript approach can sometimes be messy.
      In short, if you have the time to learn both (or multiple server-side languages) then you'll have a desirable skill-set but if not, learn Node.js (unless you're looking for one of the above career paths).
      Hope that helps?

    • @adante407
      @adante407 4 года назад +2

      @@codewithbubb Thanks for the reply James, I am more interested in Node, and the whole JS ecosystem so I will focus more on Node.

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

      Sounds like a good plan 😉

  • @TheNamesJT
    @TheNamesJT 3 года назад +2

    Okay so what if you had a index.html and your linking app.js to it and you have a function inside lib and inside the lib function you have a console.log does this show up in the browser console log? I been having this issue which is why i'm asking about it. the script html element has a type of module too. But, for some reason console.logs in another script won't show idk whats going on

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

      I'm not sure I 100% follow but yes, if you are using any code library or otherwise in the front-end then you should be able to see the result of any console.log statements you have. If you want to share the code you're using (maybe create a Gist gist.github.com/) then I might be able to help you further.

  • @rogercolque
    @rogercolque 3 года назад +1

    hi nice project.
    if to use requeried i dont need babel.
    why use import +babel.
    what happed if i already have some projects with _required and module_

    • @codewithbubb
      @codewithbubb  3 года назад +1

      Sure, yeah if you're happy to use require then you don't need the Babel setup (to use import). Babel will offer you the most up-to-date features in JavaScript however so there are other benefits to using it.

  • @oosmanbeekawoo
    @oosmanbeekawoo Год назад

    2:10 Can you tell me why now either of ‘const/let’ is required?
    When I assign anything like x = 4; normally I don't need to specify ‘const’ or ‘let’.

    • @thelearner4930
      @thelearner4930 Год назад

      In javascript you need to do that . Earlier var was used now let/const

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

    simple and precise

  • @officework8812
    @officework8812 2 года назад +1

    hi, I have started working on node js after installing it and made code that work perfect in terminal, but then I needed to transfer js results to html file.
    whenever I include js file with require statements I get weired errors.

    • @codewithbubb
      @codewithbubb  2 года назад

      Are you trying to use require in the browser? I'm not sure what you mean exactly.

    • @officework8812
      @officework8812 2 года назад

      Thank You ​@@codewithbubb !
      Actually, I want an interface to present, what actually rabbitmq is doing behind the scene.
      Like which queue is now active and what message is processed etc.
      Hope now you understand.
      Regards

  • @dominikdev621
    @dominikdev621 4 года назад +2

    Thanks mate, this video did help me a lot :D

    • @codewithbubb
      @codewithbubb  4 года назад +1

      Cheers Dominik, glad it helped you out.

  • @kez99
    @kez99 4 года назад +2

    man i just learned about this and its so cool. Is Babel used a lot in the real world/work? I'm trying to learn back-end dev with NodeJS :D

    • @codewithbubb
      @codewithbubb  4 года назад +1

      Hey Kez, yeah it's used quite frequently (at least places where I have worked) - might as well use the most up to date syntax in your code right?

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

      @@codewithbubb make sense :D Im gonna implement it on my portfolio project. Thanks a lot! :)

  • @rohitmahale3329
    @rohitmahale3329 3 года назад +1

    thank you !!

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

    i have a problem i don't know where to put the "type":"module" in json packge pls help? im using visual code

  • @madnimunne8648
    @madnimunne8648 3 года назад +1

    Help me to get rid of it
    Traceback (most recent call last): File "./configure", line 20, in from distutils.spawn import find_executable ModuleNotFoundError: No module named 'distutils

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

      How have you defined 'distutils'? I take it that's a module you're trying to import from?

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

    your are amazing...... just keep the video short and simple.. you made a bit complex

  • @AlexJaeger716
    @AlexJaeger716 2 года назад +1

    damn so much work just to import and export.. on python you just say "from __ import __"

  • @oosmanbeekawoo
    @oosmanbeekawoo Год назад

    Looks to me your seeking trouble with that Babbel!