Open osdiab opened 3 years ago
Seems that require.resolve()
isn't a reliable way to determine if a package is installed for pnp
packages, and that this library uses it for that purpose.
So the trick is probably to use a pnp-compatible package resolver like one referenced in the yarn article above.
I don't know what are the pros and cons of libraries out there but Webpack has one. https://github.com/webpack/enhanced-resolve
Perhaps the real move is to just use version 3 though.
Seems that require.resolve() isn't a reliable way to determine if a package is installed for pnp packages, and that this library uses it for that purpose.
It is perfectly fine to use it for that, but only if you require from a location that declares them, i'm guessing the resolvePath
is pointing to the wrong place
@osdiab how did you solve it? I tried to require imagemin
but still getting error.
Lol I just gave up on using it with pnp
Thanks for the great project!
With v2, I was using it in one nextJS project but then I made a new one where my NextJS project is part of a yarn workspaces monorepo, but when I start it up I get the error that image compression libraries aren't present.
so I moved the
imagemin
package deps to the rootpackage.json
of the yarn workspace, and nownext-optimized-images
is happy. It seems thatnext-optimized-images
isn't looking at the actually installed packages for the monorepo subpackage, but I haven't looked into the code to see why that is.