diff --git a/CHANGELOG.md b/CHANGELOG.md index 862abc967e..4b4035e54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Contributed: - Ledger support for Quartz (Thanks to https://github.com/CertainLach) +- Add flag to disable same-version esm/cjs warnings (Thanks to https://github.com/forgetso) Changes: diff --git a/packages/util/src/versionDetect.ts b/packages/util/src/versionDetect.ts index 795a18ae3f..97a03062be 100644 --- a/packages/util/src/versionDetect.ts +++ b/packages/util/src/versionDetect.ts @@ -121,7 +121,7 @@ export function detectPackage ({ name, path, type, version }: PackageInfo, pathO // if we have more than one entry at DIFFERENT version types then warn. If there is more than one entry at the same // version and ESM/CJS dual warnings are disabled, then do not display warnings const entriesSameVersion = entry.every((e) => e.version === version); - const esmCjsWarningDisabled = POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG in process.env && process.env[POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG] === '1'; + const esmCjsWarningDisabled = xglobal.process?.env?.[POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG] === '1'; const multipleEntries = entry.length !== 1; const disableWarnings = esmCjsWarningDisabled && entriesSameVersion;