[NPM] Load package from local

发布时间 2023-08-16 15:46:57作者: Zhentiw

In package management systems like npm (for JavaScript/Node.js projects), dependencies are typically fetched from a remote registry. However, there are times when developers want to depend on a package that is local to their machine or not published to a registry. This is where the file: protocol comes into play in the package.json file.

"dependencies": {
    "@awesome/logger": "file:../logger"
}

It means that the project has a dependency on the @awesome/logger package, but instead of downloading it from a registry (like npm's registry), it's going to source it directly from a local directory.