parent
010b41950c
commit
e936bf5392
3 changed files with 14 additions and 8 deletions
@ -1,8 +1,10 @@ |
||||
# CommonJS vs ESM |
||||
|
||||
The CommonJS module system, on the other hand, is built into Node.js. Before the introduction of the ES module in Node.js, CommonJS was the standard for Node.js modules. As a result, many Node.js libraries and modules are written with CommonJS. |
||||
A module system allows us to split up our code in different parts or to include code written by other developers. |
||||
|
||||
The ES module format was created to standardize the JavaScript module system. It has become the standard format for encapsulating JavaScript code for reuse. |
||||
Since the very beginning of NodeJS, the CommonJS module system is the default module system within the ecosystem. However, recently a new module system was added to NodeJS - ES modules. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://reflectoring.io/nodejs-modules-imports/'>CommonJS vs ESM</BadgeLink> |
||||
|
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://blog.logrocket.com/commonjs-vs-es-modules-node-js/'>CommonJS vs. ES modules in Node.js</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://reflectoring.io/nodejs-modules-imports/'>CommonJS vs. ES Modules: Modules and Imports in NodeJS</BadgeLink> |
@ -1,9 +1,9 @@ |
||||
# Global Install vs Local Install |
||||
|
||||
NodeJS and NPM allow two methods of installing dependencies/packages: Local and Global. This is mainly used when adding a package or dependency as part of a specific project you're working on. The package would be installed (with its dependencies) in `node_modules` folder **under your project**. In addition, in `package.json` file there will be a new line added for the installed dependency under the label `dependencies`. |
||||
At this point - you can start using the package in your NodeJS code by importing the package. |
||||
|
||||
Unlike the local install, you can install packages and dependencies **globally**. This would install it in a system path, and these packages would be available to any program which runs on **this specific** computer. This method is often used for installing command line tools (for example, even `npm` program is a Globally installed npm package). |
||||
NodeJS and NPM allow two methods of installing dependencies/packages: Local and Global. This is mainly used when adding a package or dependency as part of a specific project you're working on. The package would be installed (with its dependencies) in `node_modules` folder **under your project**. In addition, in `package.json` file there will be a new line added for the installed dependency under the label `dependencies`. At this point - you can start using the package in your NodeJS code by importing the package. Unlike the local install, you can install packages and dependencies **globally**. This would install it in a system path, and these packages would be available to any program which runs on **this specific** computer. This method is often used for installing command line tools (for example, even `npm` program is a Globally installed npm package). |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://docs.npmjs.com/downloading-and-installing-packages-locally'>Downloading and installing packages locally</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://docs.npmjs.com/downloading-and-installing-packages-globally'>Downloading and installing packages globally</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://docs.npmjs.com/cli/v8/commands/npm-install'>NPM Install Docs</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.geeksforgeeks.org/what-is-global-installation-of-dependencies-in-node-js/'>What is global installation of dependencies in Node.js ?</BadgeLink> |
||||
|
@ -1 +1,5 @@ |
||||
# Environment variables |
||||
# Environment variables |
||||
|
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.geeksforgeeks.org/reading-environment-variables-from-node-js/'>Reading Environment Variables From Node.js</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.twilio.com/blog/working-with-environment-variables-in-node-js-html'>Working With Environment Variables in Node.js |
||||
</BadgeLink> |
Loading…
Reference in new issue