{"id":19115,"library":"babel-plugin-nukable-import","title":"babel-plugin-nukable-import","description":"Babel plugin (v0.4.2) that removes specific named bindings from import declarations and corresponding export references. Useful for stripping development-only or debugging code from production builds. Unlike general dead-code elimination, it targets imports by source and binding name, working at AST level. Maintained by the Glimmer.js team; used within the Glimmer-VM ecosystem. Low release cadence.","status":"maintenance","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/chadhietala/babel-plugin-nukable-import","tags":["javascript","babel-plugin"],"install":[{"cmd":"npm install babel-plugin-nukable-import","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-nukable-import","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-nukable-import","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS module; use require or plugins array string syntax","wrong":"import nukableImport from 'babel-plugin-nukable-import'","symbol":"default (plugin)","correct":"module.exports = { plugins: [['nukable-import', { source: '@glimmer/debug' }]] }"},{"note":"Must be in array form with options object","wrong":"plugins: ['babel-plugin-nukable-import', { source: '@glimmer/debug' }]","symbol":"babel.config.js usage","correct":"module.exports = { plugins: [['nukable-import', { source: '@glimmer/debug' }]] }"},{"note":"Delegate must be a function, not a reference to a function defined elsewhere","wrong":"['nukable-import', { delegate: myDelegate }] where myDelegate is not a function","symbol":"delegate option","correct":"['nukable-import', { source: '@glimmer/vm', delegate(bindingName, path, types) { ... } }]"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  plugins: [\n    ['nukable-import', { source: '@glimmer/debug' }]\n  ]\n};\n\n// input.js\nimport { assert, check } from '@glimmer/debug';\nassert(someCondition);\ncheck(value, someType);\n\n// output.js\n// Both assert and check calls removed, imports removed","lang":"javascript","description":"Configures Babel to remove all bindings from '@glimmer/debug' import, stripping debug code."},"warnings":[{"fix":"Use named imports for bindings you wish to remove, or use a different plugin for default imports.","message":"Only works with named imports; default imports are not removed.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Ensure the import source has no side effects, or use sideEffects: false in package.json.","message":"Plugin removes the entire import declaration if all bindings are nuked; side effects may be lost.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use delegate only for removing call expressions or identifier references; for other cases, write a custom plugin.","message":"Delegate only receives CallExpression and Identifier paths; other expression types are ignored.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Avoid duplicate import declarations from the same source in the same file.","message":"Duplicate imports from the same source: plugin may merge or leave orphaned imports.","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":"Add a guard in your delegate: if (t.isCallExpression(path) || t.isIdentifier(path)) { ... }","cause":"Delegate called with unexpected path type, likely from non-CallExpression/non-Identifier.","error":"TypeError: Cannot read properties of undefined (reading 'isCallExpression')"},{"fix":"Use ['nukable-import', options] syntax in your Babel config.","cause":"Using plugin without array notation or misconfigured require.","error":"Error: [BABEL] unknown: Plugin/preset files are not allowed to export objects, only functions."},{"fix":"Use import.meta.glob or dynamic import, or configure Babel as CommonJS.","cause":"Using require in an ES module context.","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}