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

#6582 introduced production build error #7124

Closed
1 task done
PxlBuzzard opened this issue May 18, 2023 · 4 comments
Closed
1 task done

#6582 introduced production build error #7124

PxlBuzzard opened this issue May 18, 2023 · 4 comments
Labels
needs repro Issue needs a reproduction

Comments

@PxlBuzzard
Copy link

PxlBuzzard commented May 18, 2023

What version of astro are you using?

2.2.3, and 2.5.0 still has the issue

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

Node, middleware

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

From 2.2.3 onwards, there is an error during the build client step:

building client
vite v4.2.1 building for production...

"getDefaultExportFromCjs" is not exported by "commonjsHelpers.js", imported by "node_modules/react/index.js".
^ same error across many node_modules

RollupError: "getAugmentedNamespace" is not exported by "commonjsHelpers.js", imported by "repo/node_modules/@apollo/client/index.js?commonjs-proxy".

I don't believe @apollo/client is the culprit, it just happens to be the first package in ssr.noExternal list. I am going to dive into the exact code changes from 2.2.2 to 2.2.3 and see if I can find the issue.

Related dependency versions:

  • vite: 4.3.8 (latest, 4.2.1 saved in astro 2.2.3)
  • rollup: 3.22.0 (latest, 3.18.0 saved in vite 4.2.1)

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-zj4xwa, but I don't have a working repro yet.

Participation

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

bluwy commented May 19, 2023

From the 2.2.3 changelog, #6582 might be the likely culprit. As you mentioned there isn't a working repro, it would be a bit hard to find a fix for it, but perhaps that PR would be a clue if you'd like to debug it.

@bluwy bluwy added the needs repro Issue needs a reproduction label May 19, 2023
@PxlBuzzard
Copy link
Author

Thanks for the callout! When I revert the changes in plugin-css.ts and link it to my local project, it successfully compiles on Astro 2.5.0! I should be able to work towards a bug fix PR knowing that.

@PxlBuzzard
Copy link
Author

PxlBuzzard commented May 24, 2023

[No progress update] I've been trying on and off the last couple days to create a repro for this in the Astro test files, but I still can't get it to repro. I did try enabling cssCodeSplit: false in my failing repo and that compiles because it bypasses the failing logic. I'm not yet knowledgable enough about Vite's plugin system to how I might even make a fix.

@PxlBuzzard PxlBuzzard changed the title Astro 2.2.3 introduced CJS client compile error #6582 introduced production build error May 25, 2023
@PxlBuzzard
Copy link
Author

#7218 fixes this issue, thank you so much for your work @bluwy.

For anyone who hits this issue in the future, make sure to upgrade to at least version 2.5.6 to get the bug fix. Versions 2.2.3 through 2.5.5 contain the bug.

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

No branches or pull requests

2 participants