-
Notifications
You must be signed in to change notification settings - Fork 352
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
[Bug]: Build error - SyntaxError: Cannot use import statement outside a module when BFF is enabled #5586
Comments
Thank you for your example, this is a bug in handling esm modules by BFF. Would you prefer to use typescript first? We'll provide full support for ESM later. |
Thank you for the quick response. I understand the issue with ESM modules and will consider switching to TypeScript as a temporary solution. I greatly appreciate your support and look forward to seeing full support for ESM later. |
I've also experienced this issue, even when using TypeScript. Our setup requires our configuration to have The BFF feature ended up not fitting our use case (our application won't have a Node.js server running to serve it), so we didn't spend too much time looking into it, maybe a separate TS config for the API might solve it error. |
Currently, Modern.js server-side does not fully support esm, so the module needs to be set to |
For the original issue, I have fixed it to support using |
Version
Details
The project works normally in development mode
yarn dev
, but when trying to compile to deploy it gives the following error in the BFF folder.Reproduce link
https://github.com/rogerlpl/modernjs-discussions/tree/build-bff-error
Reproduce Steps
yarn
in the main folder.yarn build
command in this folders to run the projects.The text was updated successfully, but these errors were encountered: