Coder Social home page Coder Social logo

Comments (5)

KastanDay avatar KastanDay commented on July 17, 2024 3

I finally solved this issue by editing ./my-project/node_modules/@uploadthing/react/dist/index.mjs:119

- import { useDropzone } from "react-dropzone";
+ import pkg from 'react-dropzone';
+ const { useDropzone } = pkg;

This was suggested by the error message, and appears to work. Although it feels very wrong.

Better solutions welcomed!

from uploadthing.

KastanDay avatar KastanDay commented on July 17, 2024 1

Turns out I missed the giant warning in the docs: https://docs.uploadthing.com/nextjs/pagedir

If you're using the /pages directory in Next still, you HAVE TO DISABLE THE esmExternals FLAG:

// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    esmExternals: false, // THIS IS THE FLAG THAT MATTERS
  },
};
 
module.exports = nextConfig;

from uploadthing.

fabianszabo avatar fabianszabo commented on July 17, 2024

Have you tried deleting your node_modules directory & lock-file and re-running npm install or pnpm install (depending on what you're using)? It might help.

from uploadthing.

KastanDay avatar KastanDay commented on July 17, 2024

@caketime Thanks for the suggestion (especially since I'm junior at front-end), but after deleting node_modules and package-lock.json and npm install I got the same error.

from uploadthing.

fabianszabo avatar fabianszabo commented on July 17, 2024

@KastanDay Sorry to hear that it didn't help. React / Nextjs is also very new for me. There's lot's to learn 😄

So according to the bug report you shared, this issue comes up when react-dropzone get's into the server-side rendering part of the react app.

Maybe check if you have added uploadthing into something like a "getStaticProps" function. That was explained by theo in his web dev tutorial last month. I've also seen things being marked for server side rendering with the "use server" flag (although I don't fully understand that flag yet). Hopefully you can find the cause 🙏🏼

from uploadthing.

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.