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

Cloudflare threw exception after success deploy ( after use React component ) #5249

Closed
1 task
st1ng7ay opened this issue Oct 29, 2022 · 4 comments
Closed
1 task

Comments

@st1ng7ay
Copy link

What version of astro are you using?

1.6.1

Are you using an SSR adapter? If so, which one?

Cloudflare

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

Clean install of astro with Cloudflare adaptor.
Use React component local ( or with netlify adaptor ) - is all fine.
Deploy with out React to Cloudflare - all fine.

I'm add React component - dev and build work's fine.
wrangler Preview shows - "✘ [ERROR] _worker.js is importing from another file. This will throw an error if deployed."

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-yjxgd3?file=package.json

Participation

  • I am willing to submit a pull request for this issue.
@AirBorne04
Copy link
Contributor

"✘ [ERROR] _worker.js is importing from another file. This will throw an error if deployed."

this error is typically the result from running the cloudflare adapter in mode: "advanced" (which is also the default) and running it from a pages setting which corresponds to the mode: "directory"

To fix this please try to change the astro.config.mjs line 10 to

adapter: cloudflare({ mode: "directory" }),

@st1ng7ay
Copy link
Author

nope, it's not help :(

@AirBorne04
Copy link
Contributor

hi @st1ng7ay did you rebuild?

this stackblitz does this one change and after rebuilding it just works fine, i also verified with the react project in the astro examples directory works as expected.

@st1ng7ay
Copy link
Author

you are right.
it helps.
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants