Skip to content
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

fix(vant-area-data): export package.json #13074

Merged
merged 1 commit into from
Aug 24, 2024
Merged

Conversation

yangmingshan
Copy link
Contributor

目前 exports 没有声明 package.json,会导致构建工具无法读取这个包的 package.json

参考 1:vue-mini/create-vue-mini#16
参考 2:nodejs/node#33460

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (eef8e0b) to head (d822e41).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13074      +/-   ##
==========================================
- Coverage   89.66%   89.63%   -0.03%     
==========================================
  Files         257      257              
  Lines        6987     6987              
  Branches     1724     1724              
==========================================
- Hits         6265     6263       -2     
- Misses        382      384       +2     
  Partials      340      340              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@inottn
Copy link
Collaborator

inottn commented Aug 21, 2024

如果从构建工具层面解决,可能存在的问题是不确定 node_modules 的位置吗?

@yangmingshan
Copy link
Contributor Author

如果从构建工具层面解决,可能存在的问题是不确定 node_modules 的位置吗?

是的,要用 resolver 才行。包也应该把 package.json 暴露出来。

@inottn
Copy link
Collaborator

inottn commented Aug 21, 2024

如果从构建工具层面解决,可能存在的问题是不确定 node_modules 的位置吗?

是的,要用 resolver 才行。包也应该把 package.json 暴露出来。

我对这个 PR 的内容没有异议,但想要推动整个生态把 package.json 暴露出来是个非常艰巨的任务,从 nodejs/node#33460 能看出,很多包作者意识不到存在这个问题。

如果想要从构建工具层面部分解决这个问题,是否可以当 resolve package.json 失败时,去 resolve module 的位置,然后向上推算出 package.json 的位置呢

@yangmingshan
Copy link
Contributor Author

Node 有提案解决这个问题,在此之前先从包这边解决吧。

@yangmingshan
Copy link
Contributor Author

Node 的提案:nodejs/node#49445

@yangmingshan
Copy link
Contributor Author

@inottn 你愿意合并这个 PR 吗?

@inottn
Copy link
Collaborator

inottn commented Aug 22, 2024

@inottn 你愿意合并这个 PR 吗?

我没有合并的权限,一般 PR 会在周末统一处理的。

@inottn
Copy link
Collaborator

inottn commented Aug 22, 2024

Node 的提案:nodejs/node#49445

这个提案之前我看了,感觉已经搁置很久了 🤔

@chenjiahan
Copy link
Member

chenjiahan commented Aug 24, 2024

如果想要从构建工具层面部分解决这个问题

构建工具一般会考虑 Node.js 的 resolve 标准行为(也就是需要手动加 exports),现阶段 exports package.json 是比较合适的做法,先合并了哈

@chenjiahan chenjiahan merged commit 602b6b9 into youzan:main Aug 24, 2024
4 checks passed
@chenjiahan
Copy link
Member

released: @vant/area-data v1.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants