A Babel plugin that transforms functions to include their source code via Function.prototype.toString() for runtime introspection. Current stable version is 0.2.1 (pre-1.0.0, still experimental). The release cadence is low; last update was 2023. It is a niche tool intended for debugging, serialization, or educational demos where preserving function text is needed. Note the pre-release versioning and possible breaking changes in minor versions.
npm install babel-plugin-show-sourceVerified import paths — ran on the pinned version, not inferred.
Shows how to add the plugin to Babel config and demonstrates the transformation: after building, greet.toString() will return the original source code instead of '[Function]'.
Avoid using conflicting options; test with your Babel configuration.
Check updated output, adjust any string comparisons if needed.
Use 'plugins' array directly instead of 'env' or 'overrides' options.
Run `npm install --save-dev babel-plugin-show-source` or `yarn add -D babel-plugin-show-source`.
Use `import showSource from 'babel-plugin-show-source'` in ESM or ensure proper default import resolution in CommonJS.