Closed JL-Code closed 3 months ago
Still same problem
@JL-Code element-plus v2.6.3 and element-plus/nuxt v1.0.6 was solved
@JL-Code element-plus v2.6.3 and element-plus/nuxt v1.0.6 was solved
I used this element-plus-nuxt-starter pnpm-lock.yml
same problem
I am having the same problem. And is only happening using npm and not pnpm.
The problem was element-plus v2.7.0
it self.
I've run into this issue as well, for me, @element-plus/nuxt v1.0.8
and element-plug v2.6.3
is working.
try
export default defineNuxtConfig({
vite: {
optimizeDeps: {
include: ['dayjs', 'dayjs/plugin/*', 'element-plus']
}
}
})
Same issue, rollback to 2.6.3 was necessary
同样的问题,请问解决了吗
The problem was
element-plus v2.7.0
it self. I've run into this issue as well, for me,@element-plus/nuxt v1.0.8
andelement-plug v2.6.3
is working.
I tried it but it doesn't work
I only have this problem in linux environment
@Ena-Heleneto You are using element-plus ^2.5.3
in package.json
. That's mean the package manager will install the 2.x.y
with the x and y are latest (in this case, it's 2.7.0, it's not 2.5.3 as you thought). You can check which version was actually installed in lock file.
You should specify a version instead. try this:
- "element-plus": "^2.5.3",
+ "element-plus": "2.6.3",
@Ena-Heleneto You are using
element-plus ^2.5.3
inpackage.json
. That's mean the package manager will install the2.x.y
with the x and y are latest (in this case, it's 2.7.0, it's not 2.5.3 as you thought). You can check which version was actually installed in lock file.You should specify a version instead. try this:
- "element-plus": "^2.5.3", + "element-plus": "2.6.3",
Yes, it worked, thank you
直接改package.json里的文件再install是不生效的,默认 @element-plus/nuxt
会去安装2.7.0
的element-plus
"@element-plus/nuxt": "^1.0.8",
"element-plus": "^2.6.3",
需要手动去执行安装一下指定版本 pnpm i -D @element-plus/nuxt@=1.0.8 element-plus@=2.6.3
,暂时可以解决这个问题。
❯ pnpm i -D @element-plus/nuxt@=1.0.8 element-plus@=2.6.3
Downloading registry.npmjs.org/element-plus/2.6.3: 8.69 MB/8.69 MB, done
Packages: +2 -2
++--
Progress: resolved 901, reused 852, downloaded 1, added 2, done
devDependencies:
- element-plus 2.7.0
+ element-plus 2.6.3 (2.7.0 is available)
❯ pnpm run dev
> nuxt-app@ dev nuxt-vueuse-examples
> nuxt dev
Nuxt 3.11.2 with Nitro 2.9.6 11:33:49
11:33:50
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
ℹ Using default Tailwind CSS file nuxt:tailwindcss 11:33:51
➜ DevTools: press Shift + Option + D in the browser (v1.1.5) 11:33:51
CONFIG PROVIDER: [Function (anonymous)] 11:33:51
ℹ Tailwind Viewer: http://localhost:3000/_tailwind/ nuxt:tailwindcss 11:33:51
WARN Failed to resolve dependency: dayjs, present in 'optimizeDeps.include' 11:33:52
✔ Nuxt Nitro server built in 1487 ms nitro 11:33:54
ℹ Vite server warmed up in 2273ms 11:33:54
ℹ Vite client warmed up in 2690ms
After some investgation, I think this issue is related to vite build process. The vite is not resolving the dayjs package as excepted.
Even if add the vite config
optimizeDeps: {
include: ['dayjs', 'dayjs/plugin/*', 'element-plus']
}
For the fix, we will need to update the dayjs import to esm style when using vite and nuxt3 in time-picker.mjs
import dayjs from 'dayjs/esm'
import customParseFormat from 'dayjs/esm/plugin/customParseFormat';
in date-picker.mjs
import dayjs from 'dayjs/esm'
import customParseFormat from 'dayjs/esm/plugin/customParseFormat';
import advancedFormat from 'dayjs/esm/plugin/advancedFormat';
import localeData from 'dayjs/esm/plugin/localeData';
import weekOfYear from 'dayjs/esm/plugin/weekOfYear';
import weekYear from 'dayjs/esm/plugin/weekYear';
import dayOfYear from 'dayjs/esm/plugin/dayOfYear';
import isSameOrAfter from 'dayjs/esm/plugin/isSameOrAfter';
import isSameOrBefore from 'dayjs/esm/plugin/isSameOrBefore';
Related to this PR in dayjs https://github.com/iamkun/dayjs/pull/2543
` ERROR _dayjs.default.extend is not a function 22:54:35
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 `