We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
module
require
1 parent 793b6ff commit f73c158Copy full SHA for f73c158
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