`lazyPlugins` docs: dynamic import of a local module still slows down config loading
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Thay đổi nằm trong nguồn tài liệu đằng sau https://viteplus.dev/guide/troubleshooting#slow-config-loading-caused-by-heavy-plugins (một trang thuộc tài liệu guide, có khả năng là docs/guide/troubleshooting.md). Đọc mẹo lazyPlugins hiện có, sau đó tái hiện với hai tệp cấu hình trong nội dung issue và vp fmt --check vite.config.ts để thấy sự khác biệt 0.24s vs 0.60s. Hoàn thành nghĩa là mẹo nêu rằng import() lazy phải nhắm tới các package thay vì các module cục bộ, vì các module cục bộ được bundle cùng với config cùng với các import của chúng; tùy chọn đề cập đến phương án thay thế configLoader: 'native'.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Documentation is
- Missing
- Outdated
- Confusing
- Not sure
Explain in Detail
The troubleshooting section suggests lazyPlugins with dynamic import() for heavy plugins. This only helps if the imports target packages.
Standalone Oxfmt and Oxlint read JSON configs. In Vite+, vp fmt, vp lint, and editor integrations read the fmt and lint blocks from vite.config.ts via resolveConfig({ configFile }, 'build'), which uses configLoader: 'bundle'. The bundler follows import('./vite.plugins.ts') and processes its package imports, even though lazyPlugins skips the callback and the module never executes.
vp fmt --check vite.config.ts, median of 5 runs:
plugins |
Time |
|---|---|
| None | 0.24s |
lazyPlugins + await import('<package>') |
0.24s |
lazyPlugins + await import('./vite.plugins.ts') |
0.60s |
lazyPlugins + await import('./vite.empty.ts') (no imports) |
0.24s |
lazyPlugins + await import(new URL('./vite.plugins.ts', import.meta.url).href) |
0.24s |
vite-plus 1.0.0, Node.js 26.10.0, pnpm 12.6.0, Linux x64. Related: #2845
Your Suggestion for Changes
Note that the lazy import() should target packages, not local modules. Local modules are bundled with the config, including their imports.
Alternatively, metadata-only loads could skip bundling (e.g. configLoader: 'native').
Relevant Page
https://viteplus.dev/guide/troubleshooting#slow-config-loading-caused-by-heavy-plugins
Reproduction (Optional)
No response
Steps to reproduce (Optional)
// vite.plugins.ts
import { sentrySvelteKit } from '@sentry/sveltekit/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
export const plugins = [tailwindcss(), sentrySvelteKit(), sveltekit()];
// vite.config.ts
import { defineConfig, lazyPlugins } from 'vite-plus';
export default defineConfig({
plugins: lazyPlugins(async () => {
const { plugins } = await import('./vite.plugins.ts');
return plugins;
}),
fmt: {},
});
Run vp fmt --check vite.config.ts, then compare with the plugins imported from packages directly inside lazyPlugins.
- Ngôn ngữ chính
- Rust
- Star
- 6k
- Fork
- 271
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 183
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-plus
-
PowerShell `vp` wrapper hides failures: `$?` is `True` and `&&` keeps going after `vp` failsĐang mởpending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2934 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
voidzero-dev/vite-plus#2932 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
voidzero-dev/vite-plus#2892 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2882 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`vp config` rewrites unchanged git config on every run, so concurrent runs in linked worktrees fail with "could not lock config file"Có thể đã có người làm @naokihaba đã nhận 3 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
voidzero-dev/vite-plus#2849 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/vite-plus
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
bmander/geomsolver#118 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Three Windows builds are keyed on a later release than their layoutCó thể đã có người làm @ero-qt đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
priority:P3 type:docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
sebastian-software/ferroni#253 ·
Maintainer thường phản hồi trong vòng 1 ngày