{"id":19199,"library":"babel-plugin-transform-import-ignore","title":"babel-plugin-transform-import-ignore","description":"Babel plugin to ignore specific imports (e.g., CSS, SCSS) in Node.js environments, commonly used for server-side rendering. Version 1.1.0 is the latest stable release. Alternates process Webpack's null-loader or similar approaches, but this plugin integrates directly into the Babel pipeline, allowing pattern-based or regex-based ignoring of side-effect imports. It only removes imports that have no assigned variable (e.g., import './style.css'), preserving variable imports. Simple configuration via patterns array with wildcard support.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/hueyhe/babel-plugin-transform-import-ignore","tags":["javascript","babel-plugin"],"install":[{"cmd":"npm install babel-plugin-transform-import-ignore","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-import-ignore","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-import-ignore","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Babel plugin API","package":"@babel/core","optional":false}],"imports":[{"note":"Plugin is added to Babel config, not imported directly in code.","wrong":"","symbol":"default (plugin)","correct":"plugins: [['babel-plugin-transform-import-ignore', { patterns: ['.css'] }]]"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  presets: ['@babel/preset-env'],\n  plugins: [\n    ['babel-plugin-transform-import-ignore', {\n      patterns: ['.css', '.scss', /^\\.less$/]\n    }]\n  ]\n};\n\n// Example input (will be ignored):\nimport './style.css';\n\n// Example output (empty):\n// (nothing)\n\n// Example input (will NOT be ignored):\nimport css from './style.css';\n// Example output: unchanged\nimport css from './style.css';","lang":"javascript","description":"Shows how to configure the plugin in babel.config.js to ignore .css, .scss, and .less imports that have no variable assignment."},"warnings":[{"fix":"Ensure your import statements are without variable assignment for the plugin to remove them.","message":"Only side-effect imports (no variable assignment) are ignored. Imports like import css from '...' are not affected.","severity":"gotcha","affected_versions":"all"},{"fix":"Use regex in babel.config.js for more precise matching.","message":"Wildcard patterns may not work as expected if not using proper glob syntax. Test patterns thoroughly.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure the plugin config includes a 'patterns' array with at least one pattern.","cause":"Missing or misconfigured patterns option in plugin config.","error":"TypeError: Cannot read properties of undefined (reading 'some')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}