Draft
Conversation
8 tasks
…config files Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/oav/sessions/90b96f9c-b1f5-4c79-911e-10f9721aa8a2
Convert namespace and named imports from CJS packages to default imports
to ensure compatibility with Jest's ESM mode. CJS packages don't provide
named exports in ESM mode, so 'import { x } from "cjs-pkg"' and
'import * as x from "cjs-pkg"' don't work as expected.
Changes:
- yargs: use default import in cli.ts, type-only imports in commands
- json-pointer: use default import across all files
- js-yaml: use default import with destructuring
- commonmark: use default import
- difflib: use default import with destructuring
- ajv: separate value (default) and type-only imports
- winston: use default import
- toposort: use default import with destructuring
- fast-json-stable-stringify: simplify to default import
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ESM compatibility Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/oav/sessions/90b96f9c-b1f5-4c79-911e-10f9721aa8a2
Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/oav/sessions/90b96f9c-b1f5-4c79-911e-10f9721aa8a2
Copilot
AI
changed the title
[WIP] Convert from CJS to ESM in tsconfig.json
Convert from CJS to ESM
Mar 24, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts the module system from CommonJS to ESM, following the pattern from Azure/avocado#220.
tsconfig.json
target: esnext,module: nodenext,moduleResolution: nodenextisolatedModules: true(required by ts-jest for nodenext)package.json
"type": "module"NODE_OPTIONS="--experimental-vm-modules"for Jest ESM supportImport changes
.jsextensions to all ~430 relative importsexport typeforisolatedModulescompliancecreateRequire(import.meta.url)(prettier 2.x doesn't supportwith { type: "json" })Config files
.js→.cjs: jest.config, .eslintrc, jest.setup-file, regression jest configseslint-import-resolver-typescriptfor.js→.tsresolutionCircular dependency fix
TYPESsymbols intolib/inversifyTypes.tsto break the cycle:inversifyUtils → ajvSchemaValidator → inversifyUtilsTYPESfrominversifyTypes.tsandinversifyGetInstance/inversifyGetContainerfrominversifyUtils.tsCLI
yargs.commandDir()(usesrequire()internally) with explicit.command()calls__dirnamereplaced withimport.meta.url+fileURLToPathJest
useESM: truewithextensionsToTreatAsEsm: [".ts"]moduleNameMapperstrips.jsfrom relative imports for source resolutionjestfrom@jest/globalswherejest.setTimeout()is usedOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.