Why package.json in each component folder?
See original GitHub issueWhy does each component get its own package.json
, like this?
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
package.json - npm Docs
json which is a map of command name to local file name. When this package is installed globally, that file will be either...
Read more >Anatomy of a Package - SurviveJS
All packages come with a package.json file that contains package metadata, like information about the author, link to a bug tracker and package...
Read more >Publish Multiple Components to NPM with no package.jsons ...
json file for each of your components. The package.json file can be found in your component's folder inside your node_modules directory ( ...
Read more >(Ab)using package.json over index.js | by axelnormand
Millions of package.json I find easier to ignore than millions of index.js files :) One less js file in each folder!
Read more >node.js - Package.json - set main directory - Stack Overflow
It's documentation for a set of APIs, so each API is exported from its own sub-directory. There is no central API info that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it’s a convenience thing. It allows you to write a
require
statement for a directory instead of specific file.without
package.json
:with
package.json
containingmain
keyword:Alternatively, one could rename
Layout.js
toindex.js
. Then require-statement resolution would work withoutpackage.json
as well.One of the use cases where
package.json
can be very helpful, is when you need to create an isomorphic component, having different implementations for Node.js and Browser environments: