Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/node/src/utils/commonjs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Detect CommonJS. */
export function isCjs(): boolean {
return typeof require !== 'undefined';
return typeof module !== 'undefined' && typeof module.exports !== 'undefined';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we also checking for module.exports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just some additional safety as there is maybe a variable named module. But it's more unlikely that there is one that is an object with the key exports.

}
Loading