@gatsbyjs/parcel-namer-relative-to-cwd

中文文档
2.16.0发布于 2026/01/27MITCommonJS近 30 天下载 78.6万

Parcel namer that preserves directory structures to stabilize output and keep the hierarchy.

原始使用文档

@gatsbyjs/parcel-namer-relative-to-cwd

This namer plugin is used by Gatsby internally. You can reuse it inside your app if you want.

If you're just using Gatsby, you don't need to care about this package/plugin.

Usage

npm install --save-dev @gatsbyjs/parcel-namer-relative-to-cwd

And inside your .parcelrc:

{
  "extends": "@parcel/config-default",
  "namers": ["@gatsbyjs/parcel-namer-relative-to-cwd", "..."]
}

Why & How

By default, Parcel is trying to find common/shared directories between entries and output paths that are impacted by it. See this issue comment for more information.

With these inputs files:

a.html
sub/b.html

You get:

  • parcel build a.html => dist/a.html
  • parcel build sub/b.html => dist/b.html
  • parcel build a.html sub/b.html => dist/a.html, dist/sub/b.html

You can see that sub/b.html entry might result in either dist/b.html or dist/sub/b.html (depending wether a.html is entry or not). This makes builds not deterministic, which is very problematic where entries are "optional".

This namer plugin stabilizes the output, so inside distDir the hierarchy is the same as entry file in relation to current working directory (CWD):

  • parcel build a.html => dist/a.html
  • parcel build sub/b.html => dist/sub/b.html
  • parcel build a.html sub/b.html => dist/a.html, dist/sub/b.html

版本与发布记录

@gatsbyjs/parcel-namer-relative-to-cwd 共发布 107 个版本,首次发布于 2022/03/01;过去 12 个月发布了 2 个版本。

版本发布日期距今
2.16.0latest2026/01/279 个月前
2.17.0-next.02025/11/2711 个月前
2.15.02025/08/281.2 年前
2.16.0-next.02025/08/271.2 年前
2.15.0-next.02024/11/082 年前
2.14.02024/11/072 年前

其他发布通道:wp-image-cdn-auth → 1.1.0-alpha-wp-image-cdn-auth.20253,alpha-mdx-v2 → 1.3.0-alpha-mdx-v2.68,drupal-self-reference → 1.3.0-alpha-drupal-self-reference.18,mdxv4-rc → 1.5.0-mdxv4-rc.124,alpha-9689ff → 1.8.0-alpha-9689ff.25,preview-gh-api → 1.8.0-alpha-preview-gh-api.26。

关于 @gatsbyjs/parcel-namer-relative-to-cwd 的常见问题

@gatsbyjs/parcel-namer-relative-to-cwd 是什么?

Parcel namer that preserves directory structures to stabilize output and keep the hierarchy.

如何安装 @gatsbyjs/parcel-namer-relative-to-cwd?

在项目目录运行 npm install @gatsbyjs/parcel-namer-relative-to-cwd,或使用 pnpm add / yarn add / bun add。

@gatsbyjs/parcel-namer-relative-to-cwd 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gatsbyjs__parcel-namer-relative-to-cwd 是否存在。

@gatsbyjs/parcel-namer-relative-to-cwd 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@gatsbyjs/parcel-namer-relative-to-cwd 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0 <26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gatsbyjs/parcel-namer-relative-to-cwd 可以商用吗?

@gatsbyjs/parcel-namer-relative-to-cwd 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gatsbyjs/parcel-namer-relative-to-cwd 的下载量有多少?

根据 npm 官方下载统计,@gatsbyjs/parcel-namer-relative-to-cwd 在 2026/10/16 – 2026/11/14 这 30 天内被下载 785,669 次,日均约 26,189 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gatsbyjs/parcel-namer-relative-to-cwd 还在维护吗?

最新版本 2.16.0 发布于 2026/01/27(9 个月前);至今共发布 107 个版本,其中过去 12 个月发布了 2 个;首次发布于 2022/03/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。