WikipediaWikipedia

How to reference a local Webpack npm package

Estimated 1 minute read · Friday, 14 January 2022

With the help of this question and answer from Stack Overflow:

Install the local npm package using the file path. Check node_modules to see the installed package.

Copy
npm install --save ../

(or --save-dev depending on the requirements) && (in this example the package exists in the parent directory)

Note that you only specify the path to the package. No filename should be referenced.

The package will be referenced with the local file package. Note the file: protocol.

Copy
{
  "name": "venom",
  "scripts": {
    "build": "webpack"
  },
  "dependencies": {
    "hulk": "file:../"
  }
}
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking 'Accept', you agree to our website's cookie use as described in our Privacy Policy.