-
Notifications
You must be signed in to change notification settings - Fork 7
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]: typescript errors when building with pnpm #41
Comments
Saw that too. it is easily fixable in the template but feels very ugly import type { Core } from @strapi/strapi;
type Strapi = Core.strapi;
export default .... Will work |
@alexandrebodin I'm not able to use the workaround, still getting the same failure even after adding the import and type definition in
|
Strangely enough this works fine with Yarn. |
As @alexandrebodin explains the solution, you have to import the Strapi type wherever it is needed. import type { Core } from '@strapi/strapi';
type Strapi = Core.Strapi; Error console example, import in [ERROR] server/src/index.ts:1:27 - TS1141: String literal expected.
[ERROR] server/src/index.ts:1:34 - TS1109: Expression expected.
[ERROR] server/src/index.ts:24: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/index.ts:1:34 - TS1109: Expression expected.
[ERROR] server/src/index.ts:1:27 - TS1141: String literal expected.
[ERROR] Failed to compile TypeScript definitions |
@alexandrebodin any updates here? This is still reproducing with (as far as I can tell) anything other than yarn 1.22.22 + the workaround. |
Hi @gvillenave we have not had capacity to look at this yet I'm afraid. In future please do not directly tag team members 🙏 thanks |
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
To Reproduce
create a new plugin with init
then run
pnpm run build
Expected Behaviour
plugin should build
The text was updated successfully, but these errors were encountered: