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.
npm install babel-plugin-transform-import-ignoreVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in babel.config.js to ignore .css, .scss, and .less imports that have no variable assignment.
Ensure your import statements are without variable assignment for the plugin to remove them.
Use regex in babel.config.js for more precise matching.
Ensure the plugin config includes a 'patterns' array with at least one pattern.