Ok then packages is not exactly a JavaScript concept, it's just the name that we give to the unit of distribution through npm/yarn.
Libraries or software that gets "packaged", distributed, indexed in a common website (the npm repository) and then can be installed from a client. npm or yarn are the package managers, the piece of software that you add as a dependency in your application is called a package.
JavaScript modules are instead a recent addition to the standard. They allow you to organize code in files and import them from one another, encapsulated in a namespace (instead of having everything global like in the old days). So you might have a module that contains common behavior and import it from multiple files. Es:
I think this is the simplest explanation I can make, if you want to know more, this is a complete overview on how JavaScript modules work: developers.google.com/web/fundamen...
Ok then packages is not exactly a JavaScript concept, it's just the name that we give to the unit of distribution through npm/yarn.
Libraries or software that gets "packaged", distributed, indexed in a common website (the npm repository) and then can be installed from a client. npm or yarn are the package managers, the piece of software that you add as a dependency in your application is called a package.
JavaScript modules are instead a recent addition to the standard. They allow you to organize code in files and import them from one another, encapsulated in a namespace (instead of having everything global like in the old days). So you might have a module that contains common behavior and import it from multiple files. Es:
and then in your app you can import:
I think this is the simplest explanation I can make, if you want to know more, this is a complete overview on how JavaScript modules work: developers.google.com/web/fundamen...
Very nice. Thank you