[bug]: typescript errors when building with pnpm

オープン
#41 コメント 11 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
node.js, typescript

調査の方向性

Reproduce the issue by creating a plugin with init and running pnpm run build. Inspect TypeScript definition generation around server/src/controllers/index.ts, server/src/index.ts, and server/src/services/index.ts, along with the @strapi/pack-up entry point. Done means a newly initialized plugin builds successfully without TS2742 errors.

索引モデルが issue の本文から書いたものです。

説明

issue: bug severity: medium source: sdk-plugin
What version of @strapi/sdk-plugin are you using?

@strapi/sdk-plugin 5.1.0
pnpm 9.1.0

What's Wrong?

Building a plugin with pnpm doesn't work

➜  myplugin5 pnpm run build

> [email protected] build /Users/ben/dev/strapi/myplugin5
> strapi-plugin build

✔ Verified package.json
✔ Created build context
Building type files:
   entries:
    – myplugin5/admin/src/index.ts ./admin/src/index.ts -> ./dist/admin/src/index.d.ts
    – myplugin5/server/src/index.ts ./server/src/index.ts -> ./dist/server/src/index.d.ts
[ERROR]  server/src/controllers/index.ts:3:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/services/index.ts:3:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/controllers/index.ts:3:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/services/index.ts:3:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:19:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  Failed to compile TypeScript definitions
[ERROR] There seems to be an unexpected error, try again with --debug for more information 

 ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                                                                            │
│   Error: Failed to compile TypeScript definitions                                                                                                                                                                          │
│       at /Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@strapi/pack-up/dist/index.js:835:19                           │
│       at Array.map (<anonymous>)                                                                                                                                                                                           │
│       at Observable._subscribe (/Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@strapi/pack-up/dist/index.js:813:22)   │
│       at Observable._trySubscribe (/Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)                                                                  │
│       at /Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31                                                                                             │
│       at Object.errorContext (/Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)                                                                 │
│       at Observable.subscribe (/Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:26:24)                                                                      │
│       at /Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:86:19                                                                                             │
│       at new Promise (<anonymous>)                                                                                                                                                                                         │
│       at Observable.toPromise (/Users/ben/dev/strapi/myplugin5/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:84:16)                                                                      │
│                                                                                                                                                                                                                            │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
To Reproduce

create a new plugin with init

then run pnpm run build

Expected Behaviour

plugin should build

主要言語
TypeScript
スター
24
フォーク
13
平均マージ
5日 3時間
マージ済み PR(30日)
5

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

strapi/sdk-plugin のほかの issue

strapi/sdk-plugin の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。