Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`lazyPlugins` docs: dynamic import of a local module still slows down config loading

Đang mở Phù hợp với người mới
#2,875 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

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 pending triage
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

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của voidzero-dev/vite-plus

Tất cả issue của voidzero-dev/vite-plus

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.