Understanding Dependencies: Dependency Resolution


placeholder

This is a premium lesson.

Subscribe to get access to the entire course.

Sign up now

When building out the component library, we’ve been importing a handful of dependencies. We’ve installed lit as a production dependency, and we’ve installed publint and @web/dev-server as development dependencies. Each of these packages has its own sets of dependencies too.

How package managers resolve dependencies

When you run npm install in your project, NPM will begin by analysing your project’s primary dependencies, the dependencies you’ve defined in your package.json. It also analyses your project’s secondary dependencies. These are packages that you haven’t listed in your package.json but are instead the dependencies of your dependencies.

NPM then looks at the dependencies of your secondary dependencies via their package.json file and installs the o