Uncaught TypeError: Om is not a function

I built a react app with vite and everything works fine in the dev server, but when I build it I get a blank white page and the console contains the error:
Uncaught TypeError: Om is not a function
Uncaught TypeError: Om is not a function
I looked where it was pointing to in the code and seems to be upset at this:
h.useState(Om(Date.now()))
h.useState(Om(Date.now()))
Which seems to be this line
const [dateTime, setDateTime] = useState<dayJs.Dayjs>(dayJs(Date.now()));
const [dateTime, setDateTime] = useState<dayJs.Dayjs>(dayJs(Date.now()));
Which seems like it's saying dayjs isn't a function, but at the top of the file I have
import * as dayJs from "dayjs";
import * as dayJs from "dayjs";
And it works as intended in the development server. It only breaks when I build. Any help would be greatly appreciated.
1 Reply
T
T2y ago
I fixed it! I needed to change
import * as dayJs from "dayjs";
import * as dayJs from "dayjs";
to
import dayjs from "dayjs";
import dayjs from "dayjs";
Idk how I didn't figure it out sooner
Want results from more Discord servers?
Add your server