-
-
Notifications
You must be signed in to change notification settings - Fork 30
PostCSS types not included; TypeError #146
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
Comments
Postcss has own types, we don't need to install |
But yes, interesting, we don't use this import directly (ts generates it), look at source code https://github.com/webpack-contrib/css-minimizer-webpack-plugin/blob/master/src/utils.js#L8, looks like |
Oh dumb. I thought I saw it in my deps somewhere, but This might be naive, but do we need that line at all? It doesn't appear to actually be used anywhere: https://github.com/search?q=CssNano+repo%3Awebpack-contrib%2Fcss-minimizer-webpack-plugin+NOT+filename%3A.md+NOT+filename%3A.json&type=Code&ref=advsearch&l=&l= |
hm, can you run |
But yes, you are right we don't need this line, give me time to investigate it |
I haven't manually installed postcss, and as a result, I have three different versions. Looks like the one for
|
And can you run |
Something from dependencies install |
I found a problem - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/cssnano/package.json#L4, cssnano types are not updated for v5... let's move types directly |
None:
I don't think https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/postcss |
Yep, types are broken, fixed #147 |
Works great! Thank you! |
Bug report
When using css-minimizer-webpack-plugin with npm 7.7.6 and Typescript, the
cssnano/node_modules/postcss
is not being installed. As a result, builds fail on this type error.Actual Behavior
Expected Behavior
I know I'm not supposed to say "it should work", but, uh. It looks like you're pulling a type from somewhere that is unreliable. From what I can tell, it's possibly be the result of
@types/cssnano
being a direct dependency in your package (and getting it's deps installed), but being a transitive dependency when it's being used. Not sure. What I do know for certain is that in my project that's usingcss-minimizer-webpack-plugin
, the@types/cssnano
folder looks like this:When you pull down
css-minimizer-webpack-plugin
directly, it looks like this:How Do We Reproduce?
Using
css-minimizer-webpack-plugin
in a Typescript project should trigger this.Please paste the results of
npx webpack-cli info
here, and mention other relevant informationI suspect that if you change the type to point at
postcss
instead ofcssnano/node_modules/postcss
that this error will go away, but you may need to add@types/postcss
to your dependencies.The text was updated successfully, but these errors were encountered: