'require is not defined with dayjs in vite
I need to use the dayjs library in my Vue application but Vite does not allow me to use require as specified in the dayjs documentation. I searched a lot on the web but the little solution I could find didn't work. Do you have a solution to fix this ?
Thanks in advance 😊
here is the file i am importing from :
import dayjs from 'dayjs';
const isoWeek = require('dayjs/plugin/isoWeek');
dayjs.extend(isoWeek);
const utc = require('dayjs/plugin/utc');
dayjs.extend(utc);
the error message in the console :
vue-router.esm-bundler.js:3308
ReferenceError: require is not defined
at index.js:3:17
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
