[EVAL] Direct `eval` warning from @protobufjs/inquire during Vite 8 build

Đang mở
#486 0 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript, vite
Lĩnh vực
build-system, frontend

Hướng nghiên cứu

Start in vite.config and reproduce the Vite 8/Rolldown build to confirm the warning from node_modules/@protobufjs/inquire/index.js:12. Compare the suppression and browser-alias options described in the issue, then verify that the build succeeds without this warning and that browser behavior is unchanged.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Warning

During the build/dev process (Vite 8 / Rolldown), the following warning appears:

[EVAL] Use of direct `eval` function is strongly discouraged as it poses security risks and may cause issues with minification.
    ╭─[ node_modules/@protobufjs/inquire/index.js:12:19 ]
    │
 12 │         var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
    │                   ──┬─
    │                     ╰─── Use of direct `eval` here.
    │
    │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
────╯

Source

The eval call lives in @protobufjs/inquire (a transitive dependency pulled in via protobufjs, used by our Cosmos/protobuf tooling). It uses direct eval to conditionally require optional native modules in Node — code that is never actually needed in the browser bundle.

This is a third-party dependency, not our own code, so we can't fix the source directly. The warning is emitted by Rolldown (the bundler behind Vite 8) which flags direct eval because it defeats minification/scope analysis.

Impact

  • Cosmetic warning only — build still succeeds.
  • No runtime security risk in our bundle (the eval path is dead code in the browser).

Possible remediations

  1. Suppress the warning — configure Vite/Rolldown to ignore this specific warning for the @protobufjs/inquire module.
  2. Alias/stub the module — since inquire is only for optional Node-only native modules, alias @protobufjs/inquire to an empty/no-op module in vite.config resolve.alias for browser builds.
  3. Wait for upstream — track whether protobufjs/@protobufjs/inquire moves to indirect eval.

References

Ngôn ngữ chính
TypeScript
Star
2
Fork
5
Merge trung bình
22 giờ 35 phút
Pull request đã merge (30 ngày)
91

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 block52/ui

Tất cả issue của block52/ui

Issue tương tự

Thêm issue về TypeScript

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.