---
title: "Discussion on \"Use package.json wisely\" | Hashnode"
description: "Discussion on \"Use package.json wisely\". Control the size of your exports"
url: "https://hashnode.com/posts/use-packagejson-wisely/626d6aaba2d355d4df43f1ae"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Use package.json wisely](https://amirhe.hashnode.dev/use-packagejson-wisely?utm_source=hashnode&utm_medium=feed)

Control the size of your exports

Apr 30, 2022 · 3 min read · amirhe.hashnode.dev  
Updated May 2, 2022  
Read the article

-   [#package](https://hashnode.com/tag/package)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)
-   [#bundling](https://hashnode.com/tag/bundling)

## Written by

[Amir Hossein Ebrahimi](https://hashnode.com/@amirhe)

@amirhe · Tehran, Iran

  
[View profile](https://hashnode.com/@amirhe)

CS PhD • AI Architect • Frontend Captain • Tutor

⚡ If premature optimization is the root of all evil, Then I have an evil factory. 💬 If you are searching for new idea, there you are. ⚡ I explain things in a complex and precise manner from the beginning. 🚒 Kryptonite and misconceptions about other's profession are two of my main weaknesses. 🎨 I occasionally draw somethings.

## Responses 1

Markdown supported · ⌘↵ to post

[Masoud Salehi](https://hashnode.com/@masoudmsk)

[May 2, 2022](https://hashnode.com/posts/use-packagejson-wisely/626d6aaba2d355d4df43f1ae/comment/626faba3fa2b07f7d96a7fd2)

About the last part of this article, I'm pretty sure that no one can use this package without installing `react`, thus it's not "optional" and must not be marked as so.

For example, you could do that if your package would work with both `react` and `preact`. In this case neither of them are necessary and the developer might have installed only one of them and shouldn't see any warning.

[Amir Hossein Ebrahimi](https://hashnode.com/@amirhe)

[May 2, 2022](https://hashnode.com/posts/use-packagejson-wisely/626d6aaba2d355d4df43f1ae/comment/626faba3fa2b07f7d96a7fd2#reply-626fbfc477f8e2f7fe934ae9)

Haha, good point. Actually, the installation procedure is not skipped; npm will install the package in the 'dependencies' section; if you're interested, you can look at 'package-lock.json'.

However, the issue is whether to make a selection at the package level or as an end-developer persona.

IMHO, every non-tightly dependent output dependence should be treated as optional but should make the installation more controlled for end developers.

[Amir Hossein Ebrahimi](https://hashnode.com/@amirhe)

[May 2, 2022](https://hashnode.com/posts/use-packagejson-wisely/626d6aaba2d355d4df43f1ae/comment/626faba3fa2b07f7d96a7fd2#reply-626fbfcb77f8e2f7fe934af0)

Haha, good point. Actually, the installation procedure is not skipped; npm will install the package in the 'dependencies' section; if you're interested, you can look at 'package-lock.json'.

However, the issue is whether to make a selection at the package level or as an end-developer persona.

IMHO, every non-tightly dependent output dependence should be treated as optional but should make the installation more controlled for end developers.
