Registry / web-framework / babel-preset-metal

babel-preset-metal

JSON →
library4.1.0jsnpmunverified

A Babel preset for Metal.js projects that automatically registers components and transpiles ES2015 for IE9+ compatibility. Version 4.1.0 is the latest stable release, with maintenance updates as needed. Key differentiators: minimal configuration for Metal.js, includes all necessary transforms for the framework's component system. Alternatives like standard babel-preset-env require manual plugin setup.

npm install babel-preset-metal
INSTALL
IMPORT
SIG · BABEL-PRESET-METAL
B
babel-preset-metal
web-frameworkjavascriptv4.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
module.exports = { presets: ['metal'] }
import metal from 'babel-preset-metal'
Used as a Babel preset, not imported directly in code.
plugins
import { plugins } from 'babel-preset-metal'
const plugins = require('babel-preset-metal').plugins
Named export available in ES modules. CommonJS require may work but is discouraged in modern Babel configurations.
preset
// In .babelrc: { "presets": ["metal"] }
import preset from 'babel-preset-metal'
Preset should be referenced by string name in Babel config, not imported as a module.

Shows basic Babel configuration to transpile Metal.js components using the preset.

// .babelrc { "presets": ["metal"] } // Install npm install --save-dev babel-preset-metal@^4.0.0 // Example component import { Component } from 'metal-component'; import { Soy } from 'metal-soy'; class MyComponent extends Component { created() { this.name = 'Metal'; } } Soy.register(MyComponent, 'MyComponent'); export { MyComponent }; // Build with Babel npx babel src --out-dir build
Debug
Known issues
breakingThis preset may not be compatible with Babel 7+ as it depends on Babel 6 presets/plugins.
fix
Use @babel/preset-metal for Babel 7 or upgrade to Metal.js version that uses Babel 7.
affects: >=4.0.0
deprecatedbabel-preset-metal is deprecated in favor of @babel/preset-metal for Babel 7 compatibility.
fix
Use @babel/preset-metal instead: npm install --save-dev @babel/preset-metal
affects: >=4.0.0
gotchaThe preset includes plugins for ES2015 that may conflict with other presets (e.g., babel-preset-env) causing duplicate transforms.
fix
Avoid combining with other ES2015 presets; use babel-preset-env with 'useBuiltIns' or choose one preset.
affects: *
gotchaThe preset automatically adds the 'metal' plugin which registers components globally; this might cause issues with code splitting or lazy loading.
fix
For advanced bundling, manually configure the metal plugin with explicit registration.
affects: *
Errors
Common errors & fixes
Module build failed: Error: Couldn't find preset "metal" relative to directory
Missing babel-preset-metal package or incorrect Babel config path.
fix
Install with npm install --save-dev babel-preset-metal and ensure .babelrc is in project root.
Error: Plugin/Preset files are not allowed to export objects, only functions.
Mismatch between Babel version (Babel 7 expects functions, not objects).
fix
Upgrade to @babel/preset-metal or use Babel 6. Or configure with the standalone Babel package.
Upgrade
Version history
4.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
babel-preset-metal — npm install babel-preset-metal · libregistry