{"id":19193,"library":"babel-plugin-transform-es2015-modules-strip","title":"babel-plugin-transform-es2015-modules-strip","description":"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.","status":"deprecated","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/bardiharborow/babel-plugin-transform-es2015-modules-strip","tags":["javascript","babel-plugin"],"install":[{"cmd":"npm install babel-plugin-transform-es2015-modules-strip","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-es2015-modules-strip","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-es2015-modules-strip","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin is used via Babel config string, not imported directly in code.","wrong":"","symbol":"default","correct":"import plugin from 'babel-plugin-transform-es2015-modules-strip'"},{"note":"Babel resolves the 'babel-plugin-' prefix automatically; using full name works but is unnecessary.","wrong":"plugins: ['babel-plugin-transform-es2015-modules-strip']","symbol":"babel-plugin","correct":"plugins: ['transform-es2015-modules-strip']"},{"note":"Babel expects a string in plugins array; passing the module directly will fail.","wrong":"var strip = require('babel-plugin-transform-es2015-modules-strip'); require('@babel/core').transformSync(code, { plugins: [strip] })","symbol":"require","correct":"require('@babel/core').transformSync(code, { plugins: ['transform-es2015-modules-strip'] })"}],"quickstart":{"code":"// Install: npm install --save-dev @babel/core @babel/preset-env babel-plugin-transform-es2015-modules-strip\n// babel.config.json\n{\n  \"presets\": [\n    [\"@babel/preset-env\", {\n      \"modules\": false\n    }]\n  ],\n  \"plugins\": [\"transform-es2015-modules-strip\"]\n}\n// Input file: input.js\nimport path from 'path';\nconsole.log(path.sep);\nexport default 42;\n// Run: npx babel input.js --out-file output.js\n// Output file: output.js\nconsole.log(path.sep);","lang":"javascript","description":"Shows how to configure Babel with the plugin to strip import/export statements from a module."},"warnings":[{"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.","message":"This 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.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always set modules: false in @babel/preset-env when using this plugin.","message":"Requires @babel/preset-env with modules: false; otherwise import/export statements are transformed by preset-env before this plugin runs, causing unexpected behavior.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use 'transform-es2015-modules-strip' as the plugin name.","message":"Plugin name in Babel config should omit 'babel-plugin-' prefix. Using full name works but is non-standard.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure that the imported variables are either removed manually or are defined elsewhere (e.g., via a global script or concatenation).","message":"This 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.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev babel-plugin-transform-es2015-modules-strip'.","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'babel-plugin-transform-es2015-modules-strip'"},{"fix":"Ensure plugin is installed and use the correct short name without 'babel-plugin-' prefix.","cause":"Babel cannot resolve the plugin; possibly not installed or misnamed.","error":"Error: [BABEL] input.js: Unknown plugin \"transform-es2015-modules-strip\" specified in \"...\""},{"fix":"Add '@babel/preset-env' with modules: false to your Babel config.","cause":"Babel is not configured to handle ES modules before this plugin runs.","error":"SyntaxError: Unexpected token import"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}