Unable to resolve 'lodash/cloneDeep' import

Open
#421 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, next.js, node.js
Domain
tooling

Research direction

Inspect the package dependency declaration and the import sites identified by the lodash/cloneDeep search link. Reproduce the unresolved import in a Next.js project, then verify that the dependency declaration and import path agree and that the package resolves without requiring an extra project-level lodash installation.

Written by the indexing model from the issue text.

Description

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.

Dominant language
HTML
Stars
56
Forks
11
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudinary/js-url-gen

All issues in cloudinary/js-url-gen

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.