Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings about missing package.json with webpack 5 #203

Open
Algirdyz opened this issue Aug 3, 2021 · 5 comments
Open

Warnings about missing package.json with webpack 5 #203

Algirdyz opened this issue Aug 3, 2021 · 5 comments

Comments

@Algirdyz
Copy link

Algirdyz commented Aug 3, 2021

I'm using webpack 5 to run my project and I'm gettings these warnings every build. Everything works but I'm wondering if I can get them away.

image

@danmarshall
Copy link
Owner

Are you using yarn or npm? We've seen yarn clean up node_modules aggressively.

@Algirdyz
Copy link
Author

Algirdyz commented Aug 4, 2021

I'm using yarn 2 berry. I have no issues with other typings though

@danmarshall
Copy link
Owner

You might try this technique: #126 (comment)

@ghost
Copy link

ghost commented May 18, 2022

Having the same issue using npm and webpack 5

The warnings are slightly more descriptive now:

[...]
<w> Managed item [...]/node_modules/@types/luma.gl__constants isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
[...]

Which hints that webpack expects a package.json in each node_modules subfolder.

See https://webpack.js.org/configuration/other-options/#managedpaths and https://webpack.js.org/configuration/cache/#cachemanagedpaths.
So my understanding: For node_modules, the version is expected to be managed by package-manager, so no need for webpack to hash them. However, to do that, webpack requires package.json for versioning in each node_modules subfolder.


The error comes from https://github.com/webpack/webpack/blob/4a0937fdd0701793a6546f8670e3eed5e552ae50/lib/FileSystemInfo.js#L3518 and it seems to require the following from package.json:

const info = `${data.name || ""}@${data.version || ""}`;

I believe it should be the responsibiltiy of https://github.com/danmarshall/indefinitely-typed to generate a package.json if the user doesn't provide one. After all, indefinitely-typed ensures that each of these folders looks like a package, even if they aren't.

@danmarshall
Copy link
Owner

@JannikGM can you file this issue at https://github.com/danmarshall/indefinitely-typed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants