Custom generators are not working
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nodejs, typescript
- 领域
- tooling
调研方向
从 package.json 开始,重点查看报告中引用的 exports 配置,以及 Generator.js 中有文档说明的自定义生成器入口点。使用提供的 package.json 和 npm init 命令复现该失败;当有文档说明的外部自定义生成器能够导入 BaseGenerator 并在不出现 ERR_PACKAGE_PATH_NOT_EXPORTED 的情况下完成生成时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
API Platform version(s) affected: 3.2.20
Description
When I'm trying to get the custom generator working, it fails with an error stating that BaseGenerator is not exported.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/generators/BaseGenerator' is not defined by "exports" in /app/generator/node_modules/@api-platform/create-client/package.json imported from /app/generator/Generator.js
at new NodeError (node:internal/errors:405:5)
at exportsNotFound (node:internal/modules/esm/resolve:366:10)
at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
at packageResolve (node:internal/modules/esm/resolve:899:14)
at moduleResolve (node:internal/modules/esm/resolve:973:20)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
How to reproduce
Use the following package.json file:
{
"name": "test-generator",
"version": "1.0.0",
"type": "module",
"dependencies": {
"@api-platform/create-client": "^0.10.0"
}
}
Take generator and template from documentation https://api-platform.com/docs/create-client/custom/
Execute:
npm install
npm init @api-platform/client https://demo.api-platform.com/ ../test -- --generator "$(pwd)/Generator.js"
Additional Context
From what I see in the package.json file at https://github.com/api-platform/create-client/blob/main/package.json#L65, custom generators are tested only inside the create-client module.
- 主要语言
- TypeScript
- 星标
- 376
- 派生
- 132
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/create-client 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]`未关闭
难度 4/5 3-5 天 新手友好度 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]`未关闭
难度 3/5 1-2 天 新手友好度 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]`未关闭
难度 4/5 3-5 天 新手友好度 35/100
api-platform/create-client#394 ·
-
难度 4/5 3-5 天 新手友好度 25/100
api-platform/create-client#393 · 1 条评论 ·
查看 api-platform/create-client 的全部 Issue
相似的 Issue
-
bug confirmed perf
难度 2/5 1-3 小时 新手友好度 72/100
videojs/video.js#9400 · 1 条评论 ·
维护者通常 1 天内回复
-
good first issue hacktoberfest
难度 2/5 半天 新手友好度 70/100
HelpCode-ai/anythingmcp#996 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 1/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
beta technical-medium ui
难度 2/5 1-3 小时 新手友好度 62/100
walletbeat/walletbeat#1625 ·
维护者通常 1 天内回复
-
[Good First Issue]: Add unit tests for NetworkVersionInfo可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Good First Issue hacktoberfest
难度 2/5 1-3 小时 新手友好度 85/100
hiero-ledger/hiero-sdk-js#4489 ·
维护者通常 1 天内回复