[BUG] Unable to build strapi plugin for Strapi 5.10.4 using pnpm 10.5.2 ought of types
### Node Version

20.15.1

### NPM/Yarn/PNPM Version

pnpm 10.5.2

### Strapi Version

5.10.4

### Operating System

Linux (Other)

### Database

SQLite

### Javascript or Typescript

Typescript

### Reproduction URL

_No response_

### Bug Description

When trying to build a custom plugin with `pnpm`, it fails ought to the `strapi` types:

### Steps to Reproduce

1. Remove the dist and strapi folders.
2. Run the building script using pnpm.
3. See the log error.

### Expected Behavior

It should build the plugin without any issue.

### Logs

```shell
Building type files:
   entries:
    – strapi-plugin-lexical/admin/src/index.ts ./admin/src/index.ts -> ./dist/admin/src/index.d.ts
    – strapi-plugin-lexical/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/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:16:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/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/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:16:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:16:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:16:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/node_modules/@strapi/types/dist/core'. This is likely not portable. A type annotation is necessary.
[ERROR]  server/src/index.ts:16:1 - TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@strapi+types@5.10.4_@types+node@22.13.5_typescript@5.4.4/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 /media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/@strapi+pack-up@5.1.0_@swc+helpers@0.5.15_@types+node@22.13.   ││   5_terser@5.39.0/node_modules/@strapi/pack-up/dist/index.js:840:19                                                                                                        ││   at Array.map (<anonymous>)                                                                                                                                               ││   at Observable._subscribe (/media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/@strapi+pack-up@5.1.0_@swc+helpers@0.   ││   5.15_@types+node@22.13.5_terser@5.39.0/node_modules/@strapi/pack-up/dist/index.js:818:22)                                                                                ││   at Observable._trySubscribe (/media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/   ││   cjs/internal/Observable.js:41:25)                                                                                                                                        ││   at /media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/cjs/internal/Observable.js   ││   :35:31                                                                                                                                                                   ││   at Object.errorContext (/media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/cjs/i   ││   nternal/util/errorContext.js:22:9)                                                                                                                                       ││   at Observable.subscribe (/media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/cjs/   ││   internal/Observable.js:26:24)                                                                                                                                            ││   at /media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/cjs/internal/Observable.js   ││   :86:19                                                                                                                                                                   ││   at new Promise (<anonymous>)                                                                                                                                             ││   at Observable.toPromise (/media/Storage/Projects/Experiments/opensource/strapi-lexical/strapi-plugin-lexical/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/cjs/   ││   internal/Observable.js:84:16)                                                                                                                                            ││                                                                                                                                                                            │└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
 ELIFECYCLE  Command failed with exit code 1.
```

### Code Snippets

_No response_

### Media

_No response_

### Additional information

_No response_

### Confirmation Checklist

- [x] I have checked the existing [issues](https://github.com/strapi/strapi/issues) for duplicates.
- [x] I agree to follow this project's [Code of Conduct](https://github.com/strapi/strapi/blob/develop/CODE_OF_CONDUCT.md).