Preparing Your Package.json


placeholder

This is a premium lesson.

Subscribe to get access to the entire course.

Sign up now

Now that our repo is structured well, the next step is to ensure that we’ve provided the correct information within the package.json.

As you may be familiar with, the package.json file provides a lot of metadata about a given repo, including things like the name, version, and dependencies. The information, like the list of dependencies, is useful for us as the library author, because our package manager uses it to install the correct versions of the correct dependencies.

The package.json also provides a lot of useful information for the consumers of our library. As well as the list of dependencies, it also lets consumers know what the exports of the library are, and the module format of our component library, whether it’s “CommonJS” or “ES Modules”. Providing the wrong information, or missing information entirely, can result in the consumers facing errors when trying to import parts of our component library. It’s easy to get this wrong as different runtimes and environments often