-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Throws if either dependencies
or devDependencies
is not defined in package.json
#547
Comments
You need always install sorry - closed by mistake |
To be honest, I had the same opinion as you, but @ai as main developer of |
npm v7 automatically install peer deps, yarn throws an errors (for me it is right behavior, but this question about another problem), npm v6 output warnings, developer should read output from package manager, and packages should not check dependencies except |
Bug report
#527 introduced functionality to check for the presence of PostCSS in a project's
package.json
in order to log a warning if the version didn't match. The functionality is implemented by parsingpackage.json
and checkingpkg.dependencies.postcss
andpkg.devDependencies.postcss
.However, neither
dependencies
nordevDependencies
is a required field ofpackage.json
. If either of these fields are missing inpackage.json
, aTypeError: Cannot read property 'postcss' of undefined
will be raised.Actual Behavior
See above
Expected Behavior
A project need not define
dependencies
nordevDependencies
for this loader to work. In my specific use case, the project in question is part of a monorepo, where all dev dependencies are hoisted to the workplacepackage.json
and the project's package.json has no dev dependencies. I'm not sure if havingpostcss
declared in a monorepo root package.json but not a sub-project package.json would cause further issues.As an aside (and after reading through the initial issue thread at #507), I understand why this functionality was implemented, but in my personal opinion, "checking that peer dependencies are properly installed" should be outside the scope of any functionality in this module besides declaring the peer dep in
package.json
.How Do We Reproduce?
dependencies
in package.jsonwebpack
Please paste the results of
npx webpack info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: