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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 BUG: 'fileURLToPath' is not exported by __vite-browser-external, imported by node_modules/@astrojs/image/dist/build/ssg.js #4101
Comments
|
@annaahsu can you confirm that you're on the latest release of |
|
I'm on |
|
Ah interesting, I think it may related to a change last week that moved the node imports to use I'm not as familiar with some of the more detailed differences in Cloudflare's build environment, interesting that this seems to be a Cloudflare-specific issue 馃 |
|
I just tried deploying to Netlify and it looks like it's having the same problem. |
|
Ah ha, looks like this is actually specific to the images being used in MDX. I'm not as familiar with exactly how MDX is tied in under the covers but will loop in @bholmesdev, our resident MDX expert 馃殌 Turns out the CodeSandbox link doens't reproduce the issue in Cloudflare, but that was super helpful as a sanity check that images should work in Cloudflare Pages builds! I cloned the original project's |
|
Notes from checking with Fred - this may actually be related to an issue where Todo - test locally to see if using the latest fork linked above fixes this, if so that may just mean Vite needs a dependency version bump to pick up the fix |
|
Same issue here, but I'm not using Image or Picture inside of mdx files. Everything used to work until yesterday morning. edit: I solved my issue. Apparently I had client:load on an astro component that included my image component. Removing it fixed it. |
|
Thanks for the hint @rkuprella. Indeed it looks like the case here too. BlogImage (from Removing all the |
|
Tried to take a stab at this for a warning. So it seems like because |
|
@bluwy Good find! Yes, you're exactly right about how MDX is handled. We leave jSX un-transformed by our Vite plugin, and let Astro's JSX runtime swoop in to compile. I showed that branch to @natemoo-re and it sounds like your fix is worth PR-ing! |
|
I've having this same issue: Any ideas? |
|
Btw, the error is thrown at build time just from having an import statement in an astro component. Not evening using the Picture component.
|
|
It happened to me too this morning. Spent like 3 hours investigating. The reason was that I have mixed Astro's content collection function inside client side React // react-component.tsx
import React from 'react';
import { foo } from '~/foo'; // it's ok, regular .ts file
const MyComponent = () => {
...
foo(); // seems fine so far
...
}
// foo.ts
import { bar } from 'bar'; // now that becomes dangerous...
...
export const foo = () => bar(); // damn...
// bar.ts
import { getCollection } from 'astro:content'; // oh-oh..
...
export const bar() => {
...
getCollection('posts'); //BAAAM!! that causes the error, don't make SSR-island cocktails 馃嵏
...
}was down the import tree so it's tricky to find it. Hope that helps. I guess that's the price for the freedom and cross-compatibility Astro provides :) I still love Astro very much. |
|
Super helpful example @sergeylukin. Speaks to a need to detect server-side deps like Node with a clear error message. We're also trying to update our packages to strip out Node where possible. |
|
@bholmesdev I agree. It's a trap that is easy to get into. Would be great to have a human-readable warning sign here. Smth like "Oops...client side island X depends on server side module Y. Can't proceed. Please resolve" would be amazing 馃帀 |
What version of
astroare you using?1.0.0-rc
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
Mac
Describe the Bug
I recently attempted to upgrade to 1.0.0-rc for both MDX and
<Picture>support. I attempted to push the branch to Cloudflare (just SSG not SSR), which was unsuccessful albeit functional locally. The log file from Cloudflare is attached here.I'm not sure if the attached CodeSandbox is going to be any use, since it looks like it's either having different problems or not having a problem at all, so here's the branch I'm having issue with.
Link to Minimal Reproducible Example
https://codesandbox.io/s/annahsu-go7045?file=/README.mdEDIT: The issue is specific to images in MDX and can be reproduced locally with the original repo's
mdxbranch hereParticipation
The text was updated successfully, but these errors were encountered: