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

ReferenceError: require is not defined in production mode (dev mode works fine!) #22

Open
penobit opened this issue Jan 3, 2024 · 4 comments

Comments

@penobit
Copy link

penobit commented Jan 3, 2024

Hi there.
i have an issue with your package, it works perfectly fine on development mode, but in the build there is an error:
ReferenceError: require is not defined
image
image

im using:
package manager: yarn
build tool: Vite

System:
OS: Windows 11 10.0.22621
CPU: (8) x64 Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz
Memory: 2.35 GB / 7.82 GB
Binaries:
Node: 18.18.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.2.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.2283.0), Chromium (120.0.2210.91)
Internet Explorer: 11.0.22621.1
npmPackages:
vite: ^4.0.0 => 4.5.0

@Bravemobin
Copy link

me too
do you have any solution?

@penobit
Copy link
Author

penobit commented Jan 18, 2024

me too do you have any solution?

Hi there.
I tested many things and the didnt work.
but for another library i added this code to my vite.config.js

build: {
    commonjsOptions: {
      transformMixedEsModules: true,
    },
  },

and the problem was fixed, But i dont know it will work for this or not. I had to remove the library and use the @mui/x-date-pickers and jalali-moment for persian dates in my project.

hope my answer helped.

@Bravemobin
Copy link

oh thanks
i find another library have persian big calender
'jalali-react-big-calendar'
thanks for your response.

@ijavad805
Copy link
Owner

Hello my friends,
I'm currently using webpack, and unfortunately, I don't have a deep understanding of what's going on with Vite. I'm quite occupied in the upcoming months and won't be able to dedicate time to work on it for now, however I add it to my to do list.

Thank you for your replies. 🙂

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