A JSTransformer plugin that wraps Babel for transpiling JavaScript. Current version 2.1.0 supports Babel 6 and is in maintenance mode. The package provides a unified interface through the JSTransformer architecture, enabling render, renderFile, and renderString APIs. Unlike direct Babel usage, it filters unsupported options and supports .babelrc configuration when a filename is provided. Key differentiator: it integrates with the JSTransformer ecosystem (used by Pug, etc.) but does not include presets by default, requiring explicit presets like 'es2015' in Babel 6.
npm install jstransformer-babelVerified import paths — ran on the pinned version, not inferred.
Transpile modern JS to compatible code using Babel 6 via jstransformer-babel with preset-env.
Pass an array of presets (e.g., ['env']) or configure .babelrc.
Migrate to jstransformer v2 with updated interface.
Test derived methods thoroughly with your Babel options.
Use renderFile* or pass { filename: 'example.js' } to render.Install compatible Babel version: npm install @babel/core@^7.0.0 (if jstransformer-babel supports Babel 7) or stick to Babel 6.
npm install @babel/preset-env --save-dev
Use: const jstransformer = require('jstransformer'); const babel = jstransformer(require('jstransformer-babel'));