-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Large JavaScript build #2401
Comments
@cliffordh have you tried importing modularized categories? For example |
@elorzafe Thanks, I hadn't discovered this ability in most online examples. I'm trying to go modular using Vue with aws-amplify-vue. But I'm not sure how to go modular for this code: import Amplify, * as AmplifyModules from 'aws-amplify' Amplify.configure(aws_exports) I've done this: import Amplify from '@aws-amplify/core' But can't figure out how to pass a subset of AmplifyModules to Vue. Keep getting this error: Uncaught (in promise) TypeError: Cannot read property 'Logger' of undefined Thanks. |
I debugged the module passing issue and got things working with Vue and modular imports. For anyone who's interested, I replaced "import * as AmplifyModules" with: import { Logger } from '@aws-amplify/core' and use it like this: Vue.use(AmplifyPlugin, { AuthClass, Auth, Logger, I18n }) Hope this helps someone |
@cliffordh I think most people are using Angular or React, but it's awesome to see RL Vue examples. Thanks for posting your solution! |
@cliffordh Thanks, was looking for exactly this! |
@cliffordh Hi, although I tried importing the way you suggested, I get the same error.
followed by
Any thoughts on this? |
The funny thing is that the error has confused all of us yet it's as clear as day: it is not about finding the Logger (which is what most suggestions are trying to address) but rather that the parent object is undefined. In our cases, if you look at the stack traces, it's complaining on this line: So ... it is $Amplify that isn't set up ... forget the other modules. The following is a quick fix in Vue (at the end of your main.js or main.ts): I hope this helps ... |
I added Vue.prototype.$Amplify = Amplify; in main.js. Not working either :( Its now 3rd straight day on aws amplify vue authentication and it just doesn't work. Getting rid of Amplify for now. |
@rohitrameshrao I would place that line at the very end of main.js, just an FYI. There are many reasons not to like Amplify but this shouldn't be one of them. How about "one size fits all" approaches to commonly encountered problems? How about the lack of granularity in the encapsulation of the AWS SDK? How about the risk of getting out of sync (between code and infrastructure) and having to blow away your infrastructure, gasp, in production? How about the fact that Amplify does not anticipate or handle well the very problems that it creates? (like, "I created too many stacks for you and now I can't move forward") Amplify works great for POCs and for very well curated production projects (read: by someone who knows what they're doing and the requirements are tight). In the hands of novices or in environments that are in constant flux, it quickly becomes a nightmare. |
Hello I'm still getting this Logger error after using @cliffordh 's solution. I cannot seem to get this to work with the amplify-authenticator component with the router plugin. I'm using the router in vue and have the code in these files: main.js:
router/index.js:
App.vue.js
views/Home.vue:
Any help would be greatly appreciated! |
@ot-dchristopher 's solution worked for me. Putting his string |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
I have the latest aws amplify code. I've run "amplify add storage", "add auth", "add hosting". However, the final javascript includes GraphQL. Is it possible bundle only the components that I'm using and not pull in other pieces like GraphQL? Note, I am using this with Vue.js.
The text was updated successfully, but these errors were encountered: