Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error of element-plus occurred after update [email protected] to [email protected]. #13869

Closed
7 tasks done
Tnze opened this issue Jul 16, 2023 · 5 comments
Closed
7 tasks done

Comments

@Tnze
Copy link

Tnze commented Jul 16, 2023

Describe the bug

When I'm trying to upgrade Vite 4.4.2 -> 4.4.4 for my project, I found that newer Vite versions can't build anymore.

Tried Vite 4.4.3, doesn't work either.

import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import en from 'element-plus/lib/locale/lang/en'
import ja from 'element-plus/lib/locale/lang/ja'

Reproduction

https://stackblitz.com/edit/vitejs-vite-4t7z7a?file=package.json

Steps to reproduce

Run npm install && npm run dev when vite version is v4.4.2, which is OK.
Run npm install && npm run dev when vite version is v4.4.3 or v4.4.4, and got build error.

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 40.84 GB / 63.92 GB
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.2.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1992.0), Chromium (114.0.1823.82)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @vitejs/plugin-vue: 4.2.3 => 4.2.3
    vite: 4.4.3 => 4.4.3

Used Package Manager

yarn

Logs

Click to expand!
vite v4.4.3 building for production...
✓ 566 modules transformed.
✓ built in 2.90s
[commonjs--resolver] No known conditions for "./lib/locale/lang/zh-cn" specifier in "element-plus" package
error during build:
Error: No known conditions for "./lib/locale/lang/zh-cn" specifier in "element-plus" package
    at e (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:21424:25)
    at n (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:21424:646)
    at o (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:21424:1297)
    at resolveExportsOrImports (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:28712:20)
    at resolveDeepImport (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:28731:31)
    at tryNodeResolve (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:28422:20)
    at Object.resolveId (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/vite/dist/node/chunks/dep-210e5610.js:28183:28)
    at file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/rollup/dist/es/shared/node-entry.js:25332:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PluginDriver.hookFirstAndGetPlugin (file:///C:/Projects/tauri/ffxiv-crafting-assistant/node_modules/rollup/dist/es/shared/node-entry.js:25232:28)
       Error beforeBuildCommand `yarn build` failed with exit code 1

Validations

@stackblitz
Copy link

stackblitz bot commented Jul 16, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red
Copy link
Member

This is not a bug in Vite.
element-plus seems to change the exports field in 2.3.8 (element-plus/element-plus@3ab31b4).
element-plus/lib/* only has require condition and type condition. So you cannot import them.
Also I tried your reproduction and it doesn't work with Vite 4.4.2.

/cc @sxzz

@Tnze
Copy link
Author

Tnze commented Jul 16, 2023

image

@sapphi-red But 4.4.2 work here.

@Tnze
Copy link
Author

Tnze commented Jul 16, 2023

Nevermind. I turned to use these and they work well.

import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import ja from 'element-plus/es/locale/lang/ja'

@program-spiritual
Copy link

program-spiritual commented Jul 19, 2023

import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import ja from 'element-plus/es/locale/lang/ja'

THX, you save my time.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants