Closed wonder95 closed 2 years ago
I'm sorry, code sandbox isn't working for me and neither is Stackblitz given that this is using sharp (a Node-only package).
Tony is back next week and was close to getting us moved over to a WASM optimizer which should be much better for these platforms.
marking as p2 because I haven't heard this reported anywhere else, but will still want to get this looked at next week.
I'm also getting an error about virtual:image-loader
after starting a new blog template with the astro CLI.
[vite]: Rollup failed to resolve import "virtual:image-loader" from "node_modules/@astrojs/image/dist/lib/get-image.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external
@FredKSchott All I did to get this error was a) install Astro, b) install @astrojs/image
, and 3) import image
into a .astro
component. Are you not able to generate this error doing the same thing?
Hey @sandervspl and @wonder95, I just ran through your reproduction steps and haven't been able to break things (yet). Mind sharing a bit more info?
Actually, I was able to debug this and get it working on CodeSandbox! Looks like you forgot to add the integration to your astro.config.mjs
file (at least according to the reproduction linked)!
Can you confirm if adding this to your config fixes the problem?
import { defineConfig } from 'astro/config'
+ import image from '@astrojs/image'
export default defineConfig({
+ integrations: [image()]
})
@natemoo-re On my local, this is my current astro.config.mjs
import { defineConfig } from 'astro/config';
import vue from "@astrojs/vue";
import tailwind from "@astrojs/tailwind";
import image from "@astrojs/image";
// https://astro.build/config
export default defineConfig({
integrations: [vue(), tailwind(), image()]
});
We just pushed out new versions of astro
and @astrojs/image
which fix the known issue reported here.
can you update codesandbox to match what you're seeing locally? I downloaded your codesandbox and it ran locally on the new versions, fyi
@FredKSchott I updated my local to astro
1.0.3
and @astrojs/image
0.3.4
and it works now.
Thanks much! That was fast work.
What version of
astro
are you using?1.0.0-beta.47
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
When attempting to use
@astrojs/image
version0.3.0
, I get the following error when I attempt to import it into my.astro
component:Here is a page where I am attempting to use it.
When I open it in Code Sandbox (see linked example), I get a different error:
However, the same as with my local, when I remove the import line for
@astrojs/image
, the error goes away, and the page works.Link to Minimal Reproducible Example
https://codesandbox.io/s/snowy-flower-gfhorc?file=/src/pages/index.astro
Participation