-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
🐛 BUG: Pseudo ES6 third-party module imports fail when building #3174
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
Comments
I did some research on this in hopes of finding a work around. The source error is coming from this use of node.js' dynamic It's importing a prebuilt version of the project in the import * as $$module1 from '@builder.io/react';
import { Builder, BuilderComponent, builder } from '@builder.io/react'; I don't know enough to know why the module is being imported twice. At this point, it seems I could explore one of two directions:
Any suggestions appreciated... |
Update: This can be fixed by using |
This might not be fixed by |
Hey thanks for the update. Also great to see builder.io directly engaged in making this work. I've created a work-around that has will allow us to go live, but it's a bit janky. We basically have two different What's currently not possible is to do a "build" that runs the Builder components on the client (that is what is required for running it in their CMS). To get around this, we do the separate CMS deployment that runs in astro dev mode. But it works though. The prod build works fine now and we are achieving the goal of a no-react, pure html, css, and minimal vanilla js production website. |
Thanks for the workaround of using |
Unfortunately this package cannot be fixed on our end. The package The package will need to be upgraded to be compatible with ESM. I would suggest using Additionally I would suggest creating Node compatible ESM modules. In Node you need either You can test compatibility outside of Astro or Vite, just run Closing as there's nothing we can do on our end about this. |
I also resolved this issue by using the mentioned |
What version of
astro
are you using?1.0.0-beta.17
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
During astro build, third-party ecosystem modules that present as CJS modules under npm,
but typically have rollup build
"module": "dist/builder-react.es5.js",
type pseudo-ES6 module presentation thatworks under vite, webpack, nextJS, etc. will fail. This section in esbuild docs does a good job explaining the history
I have put together a minimal reproduction repo linked below.
This project will work when run with
npm start
.However, when trying to build with
npm run build
, it throws an error based on the import infile
/src/components/CMS.jsx
:If this recommendation is implemented, the code now fails under vite SSR because the imports are
undefined
.This used to work in astro, but the change showed up in one of the
0.2x
build prior to1.0.0-beta
. IMO, this error needs to be disabled or be configurable to allow these types of modules to be imported.I'm happy to help with a PR, but would need some direction on 1) what the desired solution is, and 2) where to go in the code
Link to Minimal Reproducible Example
https://github.com/alchemycodelab/astro-module-issue
Participation
The text was updated successfully, but these errors were encountered: