Registry / devops / enb-transpiler

enb-transpiler

JSON →
library0.1.2jsnpmunverified

An ENB tech that transpiles JavaScript files with ES6+ syntax to ES5 using Babel. Current stable version 0.1.2. Designed for the ENB build system, it processes files through a user-defined chain of transformations, including Babel transpilation and custom code wrapping. Differentiators: tight integration with ENB and BEM technologies, supports per-target configuration with source suffixes and chain modifiers. Released as an npm package with MIT license, maintained by b0rey. Minimal release cadence; last update in 2018.

npm install enb-transpiler
INSTALL
IMPORT
SIG · ENB-TRANSPILER
E
enb-transpiler
devopsjavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transpiler
✓ const transpiler = require('enb-transpiler')
✗ import transpiler from 'enb-transpiler'
Package is CommonJS only; ESM import will fail.
enb-transpiler
✓ require('enb-transpiler')
✗ require('enb/techs/transpiler')
The module is a standalone tech, not part of enb core.
enb-transpiler (type import)
✓ // no type definitions; use @types/enb-transpiler if needed
Package does not ship TypeScript types.

Configures an ENB node to transpile vanilla.js and worker.js files using Babel with env preset, adding global and ym stubs.

const transpiler = require('enb-transpiler'); const FileProvideTech = require('enb/techs/file-provider'); const bemTechs = require('enb-bem-techs'); module.exports = function(config) { config.node('bundle', function(node) { node.addTechs([ [FileProvideTech, { target: '?.bemdecl.js' }], [bemTechs.levels, { levels: ['blocks'] }], [bemTechs.deps], [bemTechs.files] ]); node.addTech([transpiler, { target: '?.worker.js', sourceSuffixes: ['vanilla.js', 'worker.js'], chain: [ 'const global = { document: { createElement: () => ({}) } }', 'ym', 'const modules = global.modules', `self.APP_VERSION = '1.0.0'`, 'source' ], params: { presets: ['env'] } }]); node.addTarget('?.worker.js'); }); };
Debug
Known issues
breakingVersion 0.1.2 removed the 'options' parameter; use 'params' instead.
fix
Replace 'options' with 'params' in tech configuration.
affects: >=0.1.2
deprecatedBabel 6 is used internally; upgrade to Babel 7 by installing babel-core@^7 and providing custom params.
fix
Install 'babel-core@7' and set 'params' to use Babel 7 presets/plugins.
affects: >=0
gotchaChain order matters: 'source' must be last to include original code; otherwise empty output.
fix
Ensure the chain array ends with 'source'.
affects: >=0
gotchaIf 'sourceSuffixes' is omitted, the tech processes no files and outputs empty target.
fix
Always specify 'sourceSuffixes' matching your file extensions.
affects: >=0
gotchaThe transplier tech does not support sourcemaps; errors will point to the bundle, not original files.
fix
Use alternative ENB techs if sourcemaps are required.
affects: >=0
Errors
Common errors & fixes
Error: Cannot find module 'babel-core'
babel-core is not installed or version mismatch.
fix
npm install --save-dev babel-core
TypeError: techs.babel is not a function
Using 'techs.babel' which is undefined; Babel options must be provided as plain object.
fix
Replace with object: { presets: ['env'] }
Error: Target '?.worker.js' not found in node's targets
Missing node.addTarget('?.worker.js') after tech.
fix
Add 'node.addTarget('?.worker.js')' after the addTech call.
Error: 'source' must be last in chain
Incorrect chain order without ending with 'source'.
fix
Ensure chain array ends with 'source'.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
enbrequiredBuild system; runtime peer dependency
babel-corerequiredTranspilation engine; used under the hood
Agent activity
4 hits · last 30 days
node
4
Resources
enb-transpiler — npm install enb-transpiler · libregistry