ajv-validator / ajv-validator/ajv

ESM native Ajv support in the (near)future or will it remain commonjs/require based?

Đang mở
#2,569 0 bình luận 3 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
14.8k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

It is heavily used library, and with browsers moving more towards native, the require() usage in Ajv becomes invalid.

For example native-federation uses ESM modules through importMaps.
Browser does not support commonJs modules in this case - require() is primarily for nodejs.

The flags in new Ajv() for esm etc do not apply - since the code itself fails to parse before it is executed. It does runtime imports of dependencies.

Right now i use a custom hack where i use esbuild t orecompile the dist/ajv.js, then use a wrapper .msj that reexports the Ajv.
And use the native federation sharing functionality to rewrite the provided code entrypoints for Ajv package.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

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.