Registry / devops / electron-compilers

electron-compilers

JSON →
library5.9.0jsnpmunverified

Provides compiler implementations (Babel, TypeScript, CoffeeScript, GraphQL, LESS, Stylus, Jade, CSON) for electron-compile in Electron apps. Current stable version is 5.9.0, but the package is in maintenance mode and tightly coupled to the deprecated electron-compile ecosystem. Key differentiator: designed to be a devDependency to avoid bloating production builds. Not actively developed; users are strongly advised to migrate to modern Electron tooling (e.g., Webpack, Vite).

npm install electron-compilers
INSTALL
IMPORT
SIG · ELECTRON-COMPILERS
E
electron-compilers
devopsjavascriptv5.9.0
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.

BabelCompiler
import { BabelCompiler } from 'electron-compilers'
const BabelCompiler = require('electron-compilers').BabelCompiler
ESM and CJS both supported; named export works with destructuring.
TypeScriptCompiler
import { TypeScriptCompiler } from 'electron-compilers'
import TypeScriptCompiler from 'electron-compilers'
Not a default export; must use named import.
CoffeeScriptCompiler
const { CoffeeScriptCompiler } = require('electron-compilers')
import { CoffeeScript } from 'electron-compilers'
CommonJS require is also valid; the export is named 'CoffeeScriptCompiler', not 'CoffeeScript'.

Shows how to instantiate the BabelCompiler and use it with electron-compile's CompilerHost to compile a file.

import { BabelCompiler } from 'electron-compilers'; import { CompilerHost } from 'electron-compile'; const compiler = new BabelCompiler({ babelConfig: { presets: ['@babel/preset-env', '@babel/preset-react'] } }); const host = new CompilerHost({ compiler, cacheDir: './.compiler-cache' }); host.compile('/path/to/input.js', 'path/to/output.js') .then(result => console.log('Compiled successfully', result)) .catch(err => console.error('Compilation failed', err));
Debug
Known issues
deprecatedThe entire electron-compile ecosystem is deprecated. electron-compilers will not receive updates for modern compilers (e.g., Babel 7+).
fix
Migrate to a modern build tool like Webpack, Rollup, or Vite.
affects: *
breakingVersion 5.0 removed support for Babel 5 and switched to Babel 6. Existing code relying on Babel 5 presets will break.
fix
Update presets/plugins to Babel 6 compatible versions (e.g., 'babel-preset-es2015' -> '@babel/preset-env' with additional packages).
affects: >=5.0 <=5.9.0
gotchaTypeScript compiler may not support all TypeScript 4+ features; only tested with TypeScript 2.x.
fix
If using TypeScript >=3, consider using tsc directly instead of this compiler.
affects: >=5.0 <=5.9.0
gotchaThe Jade compiler expects the jade package, but jade was renamed to pug. The package uses the deprecated 'jade' npm package.
fix
Use pug directly instead of the Jade compiler; or pin an old jade version.
affects: *
breakingGraphQL compiler uses an outdated graphql-tag version; may not parse modern GraphQL schema syntax.
fix
Process .graphql files with a current version of graphql-tag instead of relying on this compiler.
affects: >=5.0 <=5.9.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-core'
electron-compilers expects babel-core installed as a peer dependency, but it may be missing or mismatched.
fix
Install the required Babel version: npm install babel-core@6.26.3 (for v5) or check README.
Cannot find module 'typescript'
TypeScript compiler requires the typescript package installed but it is not declared as a dependency.
fix
Install typescript: npm install typescript@2.9.2 (or version compatible with your project).
TypeError: Cannot read property 'transpile' of undefined
The BabelCompiler is initialized without a babelConfig or with invalid config, so babel is not properly set up.
fix
Provide a valid babelConfig object with presets/plugins (e.g., { presets: ['env'] }).
Compiler 'jade' not found
Jade is deprecated and may not be installed; the compiler looks for a 'jade' module.
fix
If you need Jade support, install jade (npm install jade). Better: use pug instead.
Upgrade
Version history
5.9.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
electron-compilers — npm install electron-compilers · libregistry