-
Notifications
You must be signed in to change notification settings - Fork 25
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
TypeError: Cannot set properties of undefined when using react-live-clock with React and Vite #319
Comments
I am not the author of this repository, but could you try adding the import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
mainFields: [],
},
}); I hope this solves your problem. |
Hi @kavindunilshan, Thanks for the feedback. I don't know how VITE works. |
Also, Thanks @thesilhouettes for the response. I can't verify if it works, but still tanks :D |
@thesilhouettes Thank you!, Adding the resolve field in vite.config.js solved my issue perfectly. Much appreciated! |
@anthony0030 Thanks! I really appreciate your help! |
Happy to help @kavindunilshan. Thanks again for the solution @thesilhouettes |
Description:
I encountered an issue when using
react-live-clock
in my React project that is built with Vite. When I import and use theClock
component fromreact-live-clock
, it causes aTypeError
.This issue is same as what has been described in this Stack Overflow question: Problem using react-live-clock and react-moment.
Steps to Reproduce:
npm install --save react react-live-clock
2.Import and use the Clock component in a React component.
npm run dev
Environment:
React version: 18.2.0
Vite version: 5.2.0
react-live-clock version: 6.1.22 (also checked with 6.1.16 but both didn't work)
The error seems to be related to the internal implementation of the react-live-clock component or its interaction with the Vite build process. Any insights or workarounds for this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: