Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Strapi v5 Typescript create plugin not finding types #62

Open
tomh4 opened this issue Oct 10, 2024 · 0 comments
Open

[bug]: Strapi v5 Typescript create plugin not finding types #62

tomh4 opened this issue Oct 10, 2024 · 0 comments
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product

Comments

@tomh4
Copy link

tomh4 commented Oct 10, 2024

What version of @strapi/sdk-plugin are you using?

  • npm version: 10.5.0
  • Node version: v18.20.2
  • Strapi Version: 5.0.2
  • Plugin version: 5.2.6

What's Wrong?

When trying to create a new plugin with strapi 5 and typescript, strapi can no longer be started if plugin is used inside strapi.
While creating the plugin the following warnings appear:

[18:40:34.406] [0] $ npm install
[18:41:32.113] [0]   npm WARN ERESOLVE overriding peer dependency
[18:41:32.114] [0]   npm WARN While resolving: [email protected]
[18:41:32.114] [0]   npm WARN Found: [email protected]
[18:41:32.114] [0]   npm WARN node_modules/@strapi/admin/node_modules/typescript
[18:41:32.114] [0]   npm WARN   typescript@"5.3.2" from @strapi/[email protected]
[18:41:32.114] [0]   npm WARN   node_modules/@strapi/admin
[18:41:32.115] [0]   npm WARN     @strapi/admin@"5.0.4" from @strapi/[email protected]
[18:41:32.115] [0]   npm WARN     node_modules/@strapi/strapi
[18:41:32.115] [0]   npm WARN     8 more (@strapi/content-manager, @strapi/content-releases, ...)
[18:41:32.116] [0]   npm WARN   1 more (react-intl)
[18:41:32.116] [0]   npm WARN 
[18:41:32.116] [0]   npm WARN Could not resolve dependency:
[18:41:32.116] [0]   npm WARN peerOptional typescript@">= 4.4.x <= 5.2.x" from [email protected]
[18:41:32.116] [0]   npm WARN node_modules/@strapi/admin/node_modules/msw
[18:41:32.116] [0]   npm WARN   msw@"1.3.0" from @strapi/[email protected]
[18:41:32.116] [0]   npm WARN   node_modules/@strapi/admin
[18:41:32.116] [0]   npm WARN 
[18:41:32.116] [0]   npm WARN Conflicting peer dependency: [email protected]
[18:41:32.116] [0]   npm WARN node_modules/typescript
[18:41:32.117] [0]   npm WARN   peerOptional typescript@">= 4.4.x <= 5.2.x" from [email protected]
[18:41:32.117] [0]   npm WARN   node_modules/@strapi/admin/node_modules/msw
[18:41:32.117] [0]   npm WARN     msw@"1.3.0" from @strapi/[email protected]
[18:41:32.117] [0]   npm WARN     node_modules/@strapi/admin

when starting the app the following error appears:

plugins/new-plugin/admin/src/pages/App.tsx:1:22 - error TS2307: Cannot find module '@strapi/strapi/admin' or its corresponding type declarations.

1 import { Page } from '@strapi/strapi/admin';

To Reproduce

  • Create a new Strapi project with Typescript
  • Create a new plugin inside the Strapi project : npx @strapi/sdk-plugin init plugins/new-plugin
  • Say Y to everything
  • Add the plugin to the config file as told by the instructions:
[INFO] 
You can now enable your plugin by adding the following in ./config/plugins.ts
────────────────────────────────────────────
export default {
  // ...
  'generate-recipe': {
    enabled: true,
    resolve: 'plugins/new-plugin'
  },
  // ...
}
  • run npm run develop

Expected Behaviour

App loads

@tomh4 tomh4 added the issue: bug Issue reporting a bug label Oct 10, 2024
@innerdvations innerdvations added the severity: medium If it breaks the basic use of the product but can be worked around label Nov 28, 2024
@maccomaccomaccomacco maccomaccomaccomacco added severity: high If it breaks the basic use of the product and removed severity: medium If it breaks the basic use of the product but can be worked around labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product
Projects
None yet
Development

No branches or pull requests

3 participants