[BUG]: 当 @dcloudio/uni-components 作为某个 lib 的依赖并且处于 symlinks 时,由于 symlinks 问题导致找不到包而报错!

Open Beginner friendly
#6,108 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Read packages/uni-cli-shared/src/resolve.ts at the linked lines, then trace how resolveWithSymlinks gets its basedir when @dcloudio/uni-components is a symlinked dependency. The issue proposes resolving @dcloudio/uni-app first and using its path as the basedir; check nearby tests for this resolver and add or update coverage for the symlink case. Done means the package resolves successfully in that setup.

Written by the indexing model from the issue text.

Description

https://github.com/dcloudio/uni-app/blob/60df5861203328f7833428109f91da9f2ce27381/packages/uni-cli-shared/src/resolve.ts#L263-L284

解决方案:

@dcloudio/uni-app 始终伴随 @dcloudio/uni-components,可以先 require.resolve @dcloudio/uni-app 拿到 path,将其作为 basedir 传入 resolveWithSymlinks

Dominant language
JavaScript
Stars
41.7k
Forks
3.7k
Avg merge
1d 7h
Merged PRs (30d)
5

Getting set up

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 dcloudio/uni-app

All issues in dcloudio/uni-app

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.