tusen-ai / naive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
https://www.naiveui.com
MIT License
16.08k stars 1.67k forks source link

vite build failure: could not resolve "./window-style" from "node_modules/naive-ui/es/components.js" #4969

Closed bianyuanop closed 7 months ago

bianyuanop commented 1 year ago

TuSimple/naive-ui version (版本)

2.34.4

Vue version (Vue 版本)

3.2.47

Browser and its version (浏览器及其版本)

Chrome(112.0.5615.49)

System and its version (系统及其版本)

Ubuntu 22.04

Node version (Node 版本)

v18.15.0

Reappearance link (重现链接)

https://github.com/bianyuanop/epay_frontend

Reappearance steps (重现步骤)

npm install npm run build

Expected results (期望的结果)

Expected to build normally

Actual results (实际的结果)

error during build: RollupError: Could not resolve "./window-style" from "node_modules/naive-ui/es/components.js"

Remarks (补充说明)

Sepush commented 1 year ago

Can you provide minimum reproducibility not the entire app

lzh5261 commented 1 year ago

vite.config.ts

define: { "process.env": process.env, // "global": "window" }

Try removing "global": "window"

bianyuanop commented 1 year ago

vite.config.ts

define: { "process.env": process.env, // "global": "window" }

Try removing "global": "window"

Yea, it compiles now. Is the "global" keyword already occupied by NaiveUI? I think in some use cases, we still need to export window variable.

jahnli commented 7 months ago

This issue does not have any recent activity. If you are still experiencing similar problems, open a new error, including a minimal copy of the problem