We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
module
require
1 parent 8af26e5 commit eda7a1eCopy full SHA for eda7a1e
packages/node/src/utils/commonjs.ts
@@ -1,4 +1,8 @@
1
/** Detect CommonJS. */
2
export function isCjs(): boolean {
3
- return typeof require !== 'undefined';
+ try {
4
+ return typeof module !== 'undefined' && typeof module.exports !== 'undefined';
5
+ } catch {
6
+ return false;
7
+ }
8
}
0 commit comments