Skip to content
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

usage without typescript #407

Open
x-tropy opened this issue Dec 1, 2023 · 4 comments
Open

usage without typescript #407

x-tropy opened this issue Dec 1, 2023 · 4 comments

Comments

@x-tropy
Copy link

x-tropy commented Dec 1, 2023

This might not be an issue. I got errors to let me install types

@mosch
Copy link
Owner

mosch commented Dec 8, 2023

Please provide the errors, so we can tell.

@x-tropy
Copy link
Author

x-tropy commented Dec 8, 2023

  1. I'm using next.js, without typescript.
  2. I have installed the package correctly.
  3. Here is the example code, I directly copied into page.js
import AvatarEditor from 'react-avatar-editor';

const MyEditor = () => {
  return (
    <AvatarEditor
      image="default_avatar.png"
      width={250}
      height={250}
      border={50}
      color={[255, 255, 255, 0.6]} // RGBA
      scale={1.2}
      rotate={0}
    />
  );
};

export default MyEditor;

The error I got:

./node_modules/react-avatar-editor/src/index.ts
Module parse failed: Unexpected token (2:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import React, {
>   type TouchEventHandler,
|   type CSSProperties,
|   type MouseEventHandler,

It seems the package is not even imported. Not sure why, it'll great to get some help.

@x-tropy
Copy link
Author

x-tropy commented Dec 8, 2023

May I ask: what kind of webpack loader should I use? @mosch

@dan-lee
Copy link
Collaborator

dan-lee commented Dec 8, 2023

Do you use v13.x? There might have been a mishap in the releases. It looks like NPM latest is on v14.0.0-beta5, but this is wrong (it should only be on the beta tag)
I've released v13.0.1 (which is the same as 13.0.0) so 13.0.1 should show as the latest version again. Can you try it with this?

(I also marked the mistagged version as deprecated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants