danmarshall/indefinitely-typed

Webpack 5 expects package.json in each node_modules subfolder (`Managed item <...> isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)`)

JannikGM opened this issue · 2 comments

I've described the problem here: danmarshall/deckgl-typings#203 (comment)

Either all users of indefinitely-typed must bring their own package.json (= change indefinitely-typed documentation), or indefinitely-typed should generate a package.json (= implement feature in indefinitely-typed).

Another alternative would be to blacklist certain folders for webpack 5 managedPaths (See webpack/webpack#14509).
However, it still breaks assumptions that other tools also might have about node_modules/**/package.json and it's probably not a scalable solution (because the regex probably quickly explodes).

Do we know what should be contained within this package.json file?

For webpack, at least everything that is mentioned here: danmarshall/deckgl-typings#203 (comment) (name and version).

https://docs.npmjs.com/cli/v8/configuring-npm/package-json also only mentions name and version as required for published packages (although I'm not sure if it makes sense to have it fully npm compatible as well, even if it required more).

Also, a generated package.json should probably start with a comment, which informs the reader that this is a generated stub for tools like webpack (which could be done in the description field).