Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

882
Views
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
about 4 years ago ยท Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!