Skip to content

[bug]: typescript errors when building with pnpm #41

Open
@innerdvations

Description

@innerdvations

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked around

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions