Code Monkey home page Code Monkey logo

Comments (14)

tkejr avatar tkejr commented on May 25, 2024 7

Alright I figured out a solution

  1. First thing go here and copy the whole file https://github.com/onurzorluer/react-image-file-resizer/blob/3a0fab44211f985aaf048b4fa71027b7149da90e/src/index.js
  2. Make a file called Resizer.js in your src directory in react.
  3. Paste the code you copied in this file
  4. Whenever you want to use this function
    import Resizer from "relative path to Resizer.js";
  5. Remove import Resizer from "react-image-file-resizer"; wherever it is used

from react-image-file-resizer.

DayBr3ak avatar DayBr3ak commented on May 25, 2024 6

This is not really helpful. I don't want to locally fork the module

My workaround is to do

import Resizer from "react-image-file-resizer";
// @ts-expect-error https://github.com/onurzorluer/react-image-file-resizer/issues/68
const resizer: typeof Resizer = (Resizer.default || Resizer);

from react-image-file-resizer.

kanru avatar kanru commented on May 25, 2024

Related issue reported to vitejs vitejs/vite#4935, looks like the commonjs2 build target is not compatible with the default vite config.

from react-image-file-resizer.

ksi9302 avatar ksi9302 commented on May 25, 2024

Was anyone able to use this library with vite somehow? dying to know..

from react-image-file-resizer.

gzimbron avatar gzimbron commented on May 25, 2024

I got the same error , someone fixed this?

from react-image-file-resizer.

ysageev avatar ysageev commented on May 25, 2024

Same problem. Vite 3.0

from react-image-file-resizer.

w6fux5 avatar w6fux5 commented on May 25, 2024

same issue

from react-image-file-resizer.

mperezguendulain avatar mperezguendulain commented on May 25, 2024

Same issue

from react-image-file-resizer.

tkejr avatar tkejr commented on May 25, 2024

same issue

from react-image-file-resizer.

mikejackowski avatar mikejackowski commented on May 25, 2024

any updates on this?

from react-image-file-resizer.

FauricioValencia avatar FauricioValencia commented on May 25, 2024

same issue

from react-image-file-resizer.

nattapatpon avatar nattapatpon commented on May 25, 2024

same issue
typeError: buildExports.imageFileResizer is not a function
at onChange

from react-image-file-resizer.

Sachin249 avatar Sachin249 commented on May 25, 2024

Alright I figured out a solution

  1. First thing go here and copy the whole file https://github.com/onurzorluer/react-image-file-resizer/blob/3a0fab44211f985aaf048b4fa71027b7149da90e/src/index.js
  2. Make a file called Resizer.js in your src directory in react.
  3. Paste the code you copied in this file
  4. Whenever you want to use this function
    import Resizer from "relative path to Resizer.js";
  5. Remove import Resizer from "react-image-file-resizer"; wherever it is used

it works , thanks for your help

from react-image-file-resizer.

shahidmau avatar shahidmau commented on May 25, 2024

Alright I figured out a solution

  1. First thing go here and copy the whole file https://github.com/onurzorluer/react-image-file-resizer/blob/3a0fab44211f985aaf048b4fa71027b7149da90e/src/index.js
  2. Make a file called Resizer.js in your src directory in react.
  3. Paste the code you copied in this file
  4. Whenever you want to use this function
    import Resizer from "relative path to Resizer.js";
  5. Remove import Resizer from "react-image-file-resizer"; wherever it is used

It worked.. thanks :)

from react-image-file-resizer.

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.