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

Log warning if used with ESM #526

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Log warning if used with ESM #526

wants to merge 4 commits into from

Conversation

timokoessler
Copy link
Member

No description provided.

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@timokoessler timokoessler marked this pull request as draft February 10, 2025 15:16
@timokoessler timokoessler marked this pull request as ready for review February 10, 2025 16:15

const supported = isFirewallSupported();
const shouldEnable = shouldEnableFirewall();

if (supported && shouldEnable) {
if (isESM()) {
console.warn(
"AIKIDO: Your application seems to be running in ESM mode. Zen does not support ESM at runtime yet."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we return then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just feels safer in case there are false positive detections of the execution mode. One possibility I can think of but that's really rare is a ESM module loaded in a CJS project using something like TypeScript Execute (tsx) that also wraps require before we do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants