Registry / serialization / babel-plugin-transform-es2015-modules-strip

babel-plugin-transform-es2015-modules-strip

JSON →
library0.1.3jsnpmunverified

A Babel plugin that strips ES2015 import/export statements from JavaScript modules. Current version 0.1.3, last released as prerelease-only (no stable release after). This plugin was used by Bootstrap v4.0.0-beta through v4.1.2 to remove module syntax without bundling. It is an alternative to @babel/plugin-transform-modules-commonjs for code that is already concatenated or bundled by other tools. Requires modules: false in @babel/preset-env. Unmaintained since 2018.

npm install babel-plugin-transform-es2015-modules-strip
INSTALL
IMPORT
SIG · BABEL-PLUGIN-TRANS
B
babel-plugin-transform-es2015-modules-strip
serializationjavascriptv0.1.3
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
import plugin from 'babel-plugin-transform-es2015-modules-strip'
Plugin is used via Babel config string, not imported directly in code.
babel-plugin
plugins: ['transform-es2015-modules-strip']
plugins: ['babel-plugin-transform-es2015-modules-strip']
Babel resolves the 'babel-plugin-' prefix automatically; using full name works but is unnecessary.
require
require('@babel/core').transformSync(code, { plugins: ['transform-es2015-modules-strip'] })
var strip = require('babel-plugin-transform-es2015-modules-strip'); require('@babel/core').transformSync(code, { plugins: [strip] })
Babel expects a string in plugins array; passing the module directly will fail.

Shows how to configure Babel with the plugin to strip import/export statements from a module.

// Install: npm install --save-dev @babel/core @babel/preset-env babel-plugin-transform-es2015-modules-strip // babel.config.json { "presets": [ ["@babel/preset-env", { "modules": false }] ], "plugins": ["transform-es2015-modules-strip"] } // Input file: input.js import path from 'path'; console.log(path.sep); export default 42; // Run: npx babel input.js --out-file output.js // Output file: output.js console.log(path.sep);
Debug
Known issues
deprecatedThis package is unmaintained and has no stable release. Last version 0.1.3 was published as a prerelease but no 1.0.0 was released.
fix
Consider using a modern approach: if you need to strip imports, use @babel/plugin-transform-modules-commonjs with modules: false? Actually, modules: false already removes module syntax. This plugin is redundant when modules: false in preset-env. If you need to strip imports for bundling, use a bundler like Rollup or Webpack.
affects: >=0.0.0
breakingRequires @babel/preset-env with modules: false; otherwise import/export statements are transformed by preset-env before this plugin runs, causing unexpected behavior.
fix
Always set modules: false in @babel/preset-env when using this plugin.
affects: >=0.0.0
gotchaPlugin name in Babel config should omit 'babel-plugin-' prefix. Using full name works but is non-standard.
fix
Use 'transform-es2015-modules-strip' as the plugin name.
affects: >=0.0.0
gotchaThis plugin only strips import/export statements; it does not resolve module dependencies. If you use imported variables in the code, they will remain undeclared after stripping.
fix
Ensure that the imported variables are either removed manually or are defined elsewhere (e.g., via a global script or concatenation).
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-transform-es2015-modules-strip'
Plugin not installed or not in node_modules.
fix
Run 'npm install --save-dev babel-plugin-transform-es2015-modules-strip'.
Error: [BABEL] input.js: Unknown plugin "transform-es2015-modules-strip" specified in "..."
Babel cannot resolve the plugin; possibly not installed or misnamed.
fix
Ensure plugin is installed and use the correct short name without 'babel-plugin-' prefix.
SyntaxError: Unexpected token import
Babel is not configured to handle ES modules before this plugin runs.
fix
Add '@babel/preset-env' with modules: false to your Babel config.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
babel-plugin-transform-es2015-modules-strip — npm install babel-plugin-transform-es2015-modules-strip · libregistry