element-plus: [Build] [All] v2.7.0 Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function

Bug Type: Build

Environment

  • Vue Version: 3.4.21
  • Element Plus Version: 2.7.0
  • Browser / OS: macOS 14.0
  • Build Tool: Nuxt

Reproduction

https://codesandbox.io/p/devbox/wonderful-elion-wm8dqg?file=%2Fpackage.json%3A8%2C33 (thanks @haozileung)

Related Component

  • All

Reproduction Link

Link

Steps to reproduce

Update an existing element plus to v2.7.0

What is Expected?

Installation should be success.

What is actually happening?

Screenshot 2024-04-15 at 09 44 01

Log

> nuxt prepare


[9:29:49 AM]  ERROR  Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function


 ERROR  _dayjs.default.extend is not a function                         9:29:49 AM

  at node_modules/element-plus/es/components/time-picker/src/time-picker.mjs:10:16
  at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
  at jiti (node_modules/jiti/dist/jiti.js:1:254371)
  at node_modules/element-plus/es/components/time-picker/index.mjs:1:2184
  at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
  at jiti (node_modules/jiti/dist/jiti.js:1:254371)
  at node_modules/element-plus/es/components/calendar/src/date-table.mjs:2:1
  at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
  at jiti (node_modules/jiti/dist/jiti.js:1:254371)
  at node_modules/element-plus/es/components/calendar/src/date-table2.mjs:3:18



 ERROR  _dayjs.default.extend is not a function                         9:29:49 AM

 ELIFECYCLE  Command failed with exit code 1.

Additional comments

There was an issue on element-plus-nuxt repo https://github.com/element-plus/element-plus-nuxt/issues/95, however, the lasted of @element-plus/nuxt v1.0.8 and element-plus v2.6.3 is still working, I think the problem should be in element-plus 2.7.0 it self.

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 6
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Fixed with @element-plus/nuxt to v1.0.9.

Downgrade helped:

npm i -D @element-plus/nuxt@=1.0.8 element-plus@=2.6.3

@damtrongan I did see your commit “update Dockerfile” in my project =)))

=))) right

Downgrade helped:

npm i -D @element-plus/nuxt@=1.0.8 element-plus@=2.6.3

I tried this workaround and applied it to Docker file. It worked for me.

@trandaison Ông build dùng nuxt generate à hay là nuxt build

@HaManhCuong-2910 tui xài 2.6.3 bình thường.

Screenshot 2024-04-16 at 08 58 19

@HaManhCuong-2910 Chưa cần thiết dùng các tính năng của 2.7.0 thì ông hạ xuống 2.6.3 xài tạm đi đã, trong khi chờ issue được fix.

Ông fix được chưa

@HaManhCuong-2910 Chưa cần thiết dùng các tính năng của 2.7.0 thì ông hạ xuống 2.6.3 xài tạm đi đã, trong khi chờ issue được fix. Tôi hạ xuống 2.6.3 r mà vẫn dính lỗi đấy 😃)

@HaManhCuong-2910 Chưa cần thiết dùng các tính năng của 2.7.0 thì ông hạ xuống 2.6.3 xài tạm đi đã, trong khi chờ issue được fix.