-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
@aws-amplify/ui-react not recognized as ESM #543
Comments
Just wanted to confirm that pre-rendering is indeed the issue. If I change Thanks again for your help on this! I expect I'm not the only one struggling to use AWS Amplify in the Vite ecosystem. |
As far as reading the {
"name": "@aws-amplify/ui-react",
"version": "4.2.0",
"main": "dist/index.js",
"module": "dist/esm/index.js", I modified both files locally in node_modules (adding a log statement), and the non-ESM one is being used by Vite. Not sure why this is. During Also, I'm running the latest version of Vite (3.2.5) and vite-plugin-ssr (0.4.54) |
Yea, a reproduction would be the best. Also, FYI there is also
That'd be great. Definitely makes a difference and with enough sponsors we can all looking forward to a bright VPS future. |
Thanks @brillout , reproduction here ( |
Seems like AWS Amplify's build is broken. The ESM build of Does it work with Next.js? I don't think it does, so it's a A workaround is to use Happy to further investigate, especially if your company ends up sponsoring! |
Hey @brillout , thanks for looking into this. I also posted on the AWS Amplify Discord yesterday but haven't heard back. Unfortunately, I need AWS Amplify UI to work well for authentication at work (we use AWS for everything and it's a startup so I can't justify writing my out auth state management & UI), so I've swapped out Vite for NextJS since they're compatible with Webpack, sigh. Here's hoping AWS Amplify eventually becomes compatible with Vite and the broader non-Webpack ecosystem. If they do, I hope to return to using Vite and get your plugin sponsored. Thanks again for your help, and for all the work you do to make the Vite ecosystem great. |
I further checked and, indeed, it works with Next.js. What's going on is that Next.js bundles the You can achieve the same with Vite by adding I forked your reproduction and made it work: https://github.com/brillout/vite-prerender-aws-amplify-compat.
👍 No worries if you don't. Although note that if you do end up choosing and sponsoring VPS, then you can expect direct support from me.
Keep me updated whether you end up with Next.js or Vite/vite-plugin-ssr. I do care about knowing the reasons leading users to chose Next.js over Vite. Thanks! |
Created a bug report over at AWS Amplify: aws-amplify/amplify-ui#3155. In the meantime, use the |
Hey, thanks @brillout ! I'll be on vacation for the next few weeks but will check back in at the end of the month. |
Sounds good. Have a restful vacation.
…On Mon 12. Dec 2022 at 18:42, Micah Engle-Eshleman ***@***.***> wrote:
Hey, thanks @brillout <https://github.com/brillout> ! I'll be on vacation
for the next few weeks but will check back in at the end of the month.
—
Reply to this email directly, view it on GitHub
<#543 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHVQRV5N7YSY2WC7WVCAOLWM5PXPANCNFSM6AAAAAASXFL3XM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey @brillout , just a heads up that we're now sponsoring you (nicka-redwood is my boss at Redwood Materials). I realize it's not a large amount, but hopefully it helps. As our team and production apps grow, I expect we can do more. Really appreciate your help w/ this issue and others! |
Thanks Micah 💚, I appreciate it a lot! If you can, also say thanks to Nicka 💚. Let me know if you have any questions. Also, feel free to PM me on Discord, I can create a private channel for live VPS support. |
Description
I'm working on integrating authentication into my app using the AWS Amplify library. AWS maintains a React library used for rendering user-related UI (e.g. login, logout, reset password, etc)
NPM: https://www.npmjs.com/package/@aws-amplify/ui-react
Docs: https://ui.docs.amplify.aws/
This package works great on the client (
npm run dev
), but when I runnpm run build
, Vite is no longer able to import the named exports from this package (see error below)My project's structure is based on the
react-full
example: pre-rendering HTML during build. I just updated thePageShell.tsx
file so it includes an authentication provider and then I use authentication hooks & components in my pages/child-components. Should all be pretty basic React stuff, but happy to setup a basic repo to reproduce the issue if that'd be helpful.I set things up identically with the
boilerplate-react-ts
example and things worked fine, so it must have to do with pre-rendering.My best guess is that
vite-plugin-ssr
is having trouble reading thepackage.json
file for this package correctly:https://github.com/aws-amplify/amplify-ui/blob/main/packages/react/package.json
Also @brillout , I just got approval to sponsor your project--need to wait on some internal review processes but expect to start paying in late December / early January
Thanks again!
Error Message + Error Stack
The text was updated successfully, but these errors were encountered: