TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Optimized package imports in Next.js

2 点作者 leerob超过 1 年前

1 comment

jitl超过 1 年前
We’re considering how we can express “directory private&#x2F;public” exports in Notion’s codebase. One idea is to consider file names starting with _ as “private” eg smyFeature&#x2F;_internalClass.ts could be imported by other files in myFeature&#x2F; but not by anything in yourFeature&#x2F;. But doing file level granularity would encourage barrel modules without the _ to re-export stuff publicly, eg myFeature&#x2F;public.ts.<p>These numbers show a good reason to go with a different strategy that allows per-export public&#x2F;private instead, so consumers only pay for what they actually get!