Closed dovydas0 closed 7 months ago
Hey @doovis,
thanks for reporting this bug. However, I cannot reproduce this behavior, neither in your example nor any other project. Are you still facing this issue?
Hello @manuelschroederdev , I am able to reproduce a similar issue with @storyblok/astro package .Screenshot below
Same. Virtual modules are unimported?
I have the same issue as well. It's this virtual module.
Also get another type error on blok.component
StoryblokComponent.astro
/**
* convert blok components to camel case to match vite-plugin-storyblok-components
*/
let key = camelcase(blok.component);
Argument of type 'string | undefined' is not assignable to parameter of type 'string | readonly string[]'.
Type 'undefined' is not assignable to type 'string | readonly string[]'.ts(2345)
I made a PR for the latter:
I am facing the same issue. I don't think I am experienced enough to be of any help but I ma getting the same error with the virtual modules not being found in the StoryblokComponent definition inside node_modules/@storyblok/astro/StoryblokComponent.astro.
Hey, second this, have the exact same error
i am following the astro guide & have the package installed
{
"name": "test",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@storyblok/astro": "^3.0.0",
"astro": "^3.0.11",
"storyblok-js-client": "^6.0.0",
"vite": "^4.4.9"
}
}
I am getting the exact same error like @Britnell with the exact same dependencies.
:tada: This issue has been resolved in version 3.0.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I'm on version 3.0.1 and I'm still seeing this error message. It appears to work anyway however. 🤷
Hey @shixish, thanks for sharing. That's weird and I cannot reproduce it. Could you please share a minimal reproducible example?
@manuelschroederdev I put together a minimal setup here: https://github.com/shixish/minimal-astro-storyblok/
The issue can be seen in both of these files:
I tried out this new repo with my Storyblok preview token and this repo appears to work. 👍
:tada: This issue has been resolved in version 3.1.0-next.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I'm currently having an error similar like above where camelcase is giving a type error:
TypeError: Expected the input to be
string | string[] at Module.camelCase (file:///C:/Projecten/website-stvn/node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js:59:9) at C:\Projecten\website-stvn\node_modules\.pnpm\@storyblok+astro@3.1.0-next.3_astro@4.0.6\node_modules\@storyblok\astro\components\StoryblokComponent.astro:24:11 at AstroComponentInstance.StoryblokComponent [as factory] (C:\Projecten\website-stvn\node_modules\.pnpm\astro@4.0.6_typescript@5.3.3\node_modules\astro\dist\runtime\server\astro-component.js:18:12) at AstroComponentInstance.init (C:\Projecten\website-stvn\node_modules\.pnpm\astro@4.0.6_typescript@5.3.3\node_modules\astro\dist\runtime\server\render\astro\instance.js:33:29) at AstroComponentInstance.render (C:\Projecten\website-stvn\node_modules\.pnpm\astro@4.0.6_typescript@5.3.3\node_modules\astro\dist\runtime\server\render\astro\instance.js:38:18) at Object.render (C:\Projecten\website-stvn\node_modules\.pnpm\astro@4.0.6_typescript@5.3.3\node_modules\astro\dist\runtime\server\render\component.js:328:22) at Module.renderChild (C:\Projecten\website-stvn\node_modules\.pnpm\astro@4.0.6_typescript@5.3.3\node_modules\astro\dist\runtime\server\render\any.js:29:17) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
I'm on node 21.3.0 using pnpm and tried out every version of the storyblok-astro package but having this issue on every version.
Package.json file:
I see the same error shared by @shixish and @Britnell on version ^4.0.0. I'm following the example from Storyblok & Astro integration docs
test-post.astro
astro.config.mjs
I stumbled upon this issue too with v4.0.2
As per https://stackoverflow.com/a/74976845,
Important: Node Package Imports are supported only when moduleResolution is set to "nodenext" or "node16".
it seems the client need to set the moduleResolution in the tsconfig compilerOptions:
tsconfig.json
...
"compilerOptions": {
"moduleResolution": "nodenext", // also node16 or bundler
...
}
...
It seems bundler
option works fine as it does not require the extensions to be there. But still I cannot make it to fully work 🤔
I see that the DEMO https://stackblitz.com/edit/astro-sdk-demo?file=tsconfig.json extends from astro/tsconfigs/base which has the: "moduleResolution": "Node16",
Thanks everyone for reporting. Could you all try with @storyblok/astro 4.0.3? This version should fix the issue, as I tested and it worked.
Related issue #637
Feel free to re-open this issue if you face a similar case.
Describe the issue you're facing
When building a page with Astro importing StoryblokComponent.astro component into .astro file gives back a type declaration error. However, other SDK's functions like "useStoryblokApi" are not giving any errors.
The Astro app is running even with an error and the StoryblokComponent is working. But ideally the error should not be there. I could not find any @types/ packages for the @storyblok/astro SDK. But if I go to /src/env.d.ts and provide this line of code: "declare module '@storyblok/astro/StoryblokComponent.astro';" the type error goes away.
Reproduction
https://github.com/doovis/storyblok-bug/blob/master/src/pages/index.astro
Steps to reproduce
Just opening up /src/pages/index.astro should show the error on the "StoryblokComponent" import line.
System Info
Used Package Manager
yarn
Error logs (Optional)
No response
Validations