Last active
October 30, 2022 02:51
-
-
Save ganeshkbhat/039f601b72f650535bc44502bda4c38c to your computer and use it in GitHub Desktop.
Find if a code is a ESM Module or a CommonJS Script or Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkEsm = import("check-esm"); | |
let isesm = checkEsm._isESCode("./isESCode.mjs"); | |
console.log(isesm); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkEsm = require("check-esm"); | |
let isesm = checkEsm._isESCode("./isESCode.cjs"); | |
console.log(isesm); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { _isESCode } from "check-esm"; | |
let isesm = _isESCode("./isESCode.js"); | |
console.log(isesm); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment