Giter Club home page Giter Club logo

Comments (4)

ottokruse avatar ottokruse commented on August 27, 2024

Thanks for the report. Can you share any more specifics around the error? And is it possible to provide steps/code to reproduce?

from amazon-cognito-passwordless-auth.

ottokruse avatar ottokruse commented on August 27, 2024

I was able to reproduce this by creating a sample next app and import the Passwordless React hooks and components (in a next component marked as 'use client', otherwise you run into another issue with localStorage being undefined).

Turns out when you do this in your JS code: import spinner from "../assets/spinner.gif", as we do, NextJS wants you to access the source location using the src property, e.g. <img src={spinner.src} />, however we do <img src={spinner} /> (without .src). Must be a bundling issue, Vite is fine with doing it as we do, and I believe it is the common way in React.

Note Next would support what we do if you use their Image component, instead of plain img: https://nextjs.org/docs/pages/building-your-application/optimizing/images

Not sure what to do with this. Any idea @EricBorland ?

from amazon-cognito-passwordless-auth.

EricBorland avatar EricBorland commented on August 27, 2024

Would the following work in Next?

import spinner from "../assets/spinner.gif"
const spinnerWrapper = {
  src: spinner
};

[...]
<img src={spinnerWrapper.src} />

If not, I guess another option is to reference the image by its url instead of importing directly in the code...

from amazon-cognito-passwordless-auth.

ottokruse avatar ottokruse commented on August 27, 2024

Fixed by #63 which is included in https://github.com/aws-samples/amazon-cognito-passwordless-auth/releases/tag/v0.6.6 onwards

from amazon-cognito-passwordless-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.