js-url-gen icon indicating copy to clipboard operation
js-url-gen copied to clipboard

Unable to resolve 'lodash/cloneDeep' import

Open mmmulani opened this issue 4 years ago • 4 comments

Not sure if this bug is caused by my setup or how module resolution works in node (it seems like this is an unclear area), so apologies if this is a false report.

But when I try to use @cloudinary/base in my Next.js project, I get an error about failing to resolve lodash/cloneDeep, and then indeed I see that various places import it like lodash/cloneDeep: https://github.com/cloudinary/cloudinary-js-base/search?q=lodash%2FcloneDeep

but in the package dependencies, it is written as lodash.cloneDeep. Should this be switched to import cloneDeep from 'lodash.cloneDeep';?

I monkey-patched the files locally and changing the import statements to lodash.cloneDeep fixed the issue. I also was able to get the package working locally by just installing lodash to my whole project.

mmmulani avatar Aug 22 '21 09:08 mmmulani

Hi, Would you try and it should resolve this issue. npm i lodash Please let me know if this works. Thanks, Mo

momoip avatar Aug 24 '21 21:08 momoip

hey, installing lodash works but it seems like this should be included in the package.json for this package then?

mmmulani avatar Aug 24 '21 23:08 mmmulani

Good idea. I will pass it on to our Dev team. Thanks.

momoip avatar Aug 25 '21 00:08 momoip

@mmmulani thanks for reporting this issue, we've merged a fix and it will be part of the next version: https://github.com/cloudinary/cloudinary-js-base/commit/41dbf2a691865d353cb2fad2def6fd32a227e8a7

ghost avatar Aug 25 '21 12:08 ghost