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

const antdLocale: any = await import(../../node_modules/ant-design-vue/es/locale/${locale}.js);语句在Windows生产环境中挂住 #16520

Closed
7 tasks done
lazebird opened this issue Apr 24, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@lazebird
Copy link

lazebird commented Apr 24, 2024

Describe the bug

  1. 经测试导入英语正常,导入中文异常;开发版本没问题,Linux似乎也没有问题,仅Windows发布版本异常
  2. 测试2.8.6版本正常,2.9.0及最新版本4.2异常,不完全覆盖中间版本
  3. 参考https://github.com/lazebird/tauri 需要pnpm build编译生产版本,使用web服务器加载出问题

Reproduction

https://github.com/lazebird/tauri

Steps to reproduce

参考https://github.com/lazebird/tauri 需要pnpm build编译生产版本,使用web服务器加载出问题

System Info

$ npx envinfo --system --npmPackages '{vite,@vitejs/*,rollup}' --binaries --browsers

  System:
    OS: Windows 11 10.0.22621
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
    Memory: 6.39 GB / 15.95 GB
  Binaries:
    Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.0.5 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @vitejs/plugin-vue: ^2.0.2 => 2.3.4
    rollup: ^4.16.0 => 4.16.0
    vite: 2.9.0 => 2.9.0

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red
Copy link
Member

This is caused by top-level await not handled correctly by rollup: rollup/rollup#4708
The workaround is to rewrite main.ts to

import { createApp } from 'vue';
import App from './App.vue';
import { setupRouter } from './router';
import { setupStore } from './store';
import { setupI18n } from './locales/setupI18n';

// import Antd from 'ant-design-vue';
// import 'ant-design-vue/dist/reset.css';

const app = createApp(App);
;(async () => {
  // app.use(Antd);
  await setupStore(app);
  await setupI18n(app);
  setupRouter(app);
  app.mount('#app');
})();

@sapphi-red
Copy link
Member

Duplicate of #10995

@sapphi-red sapphi-red marked this as a duplicate of #10995 Apr 25, 2024
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants