A fork of @babel/code-frame that provides code frame generation for error messages, using updated dependencies like chalk 5 and exported as pure ESM. Current version 1.1.0 offers the same API as @babel/code-frame but with modernized internals and TypeScript support. It is maintained, with no active development. Key differentiator: drops CommonJS support entirely, requiring Node 14.13.1+ and ESM-only environment; uses latest chalk for terminal colors, which can break Jest and other CJS-based tooling.
npm install awesome-code-frameVerified import paths — ran on the pinned version, not inferred.
Shows basic usage of codeFrameColumns with a sample code snippet, location, and options.
Use import() dynamic import or switch to ESM in your project
Set transformIgnorePatterns to allow transforming awesome-code-frame and chalk, or use jest-environment-jsdom with custom transform
Upgrade Node to >=14.13.1 or >=16.0.0
Use import { codeFrameColumns } from 'awesome-code-frame' instead of require()Run npm install chalk or add chalk to your dependencies
Add 'awesome-code-frame' to transformIgnorePatterns exception: 'transformIgnorePatterns: ["node_modules/(?!(awesome-code-frame|chalk)/)"]'