import-glob-loader

raw JSON →
1.1.0 verified Sat Apr 25 auth: no javascript maintenance

Webpack pre-loader that expands glob patterns in import statements (e.g., @import "foo/**/*" becomes multiple explicit imports). Version 1.1.0, stable with no recent updates. Designed for Sass/SCSS, CSS, or ES6 imports, it performs vertical expansion only. Unlike other glob loaders, it runs as a pre-loader to avoid interfering with other loaders. Options pass through to node-glob with custom test and delimiter settings. Supports Webpack 1–3, no longer actively maintained.

error Module build failed: Error: Cannot find module 'import-glob-loader'
cause Loader not installed or missing devDependency.
fix
Run npm install import-glob-loader --save-dev.
error Module build failed: Error: No matching loader for import-glob! Unsupported
cause Using as a regular loader in wrong chain order.
fix
Place it as a pre-loader or in the 'enforce: pre' position.
gotcha Only performs vertical expansion; horizontal expansion (e.g., combining multiple imports into one line) is not supported.
fix Use a different loader or manual imports for horizontal expansion.
gotcha Test option uses word-boundary matching; '@import' matches but 'importScript' does not.
fix Adjust test regex if needed. Default is /import/.
deprecated Package uses preloaders, deprecated in Webpack 4+. Replace with 'enforce: pre' in module.rules.
fix Use 'enforce: pre' in your rule configuration.
npm install import-glob-loader
yarn add import-glob-loader
pnpm add import-glob-loader

Configures import-glob-loader as a pre-loader for .scss files to expand glob patterns before other loaders.

// webpack.config.js
module.exports = {
  module: {
    rules: [{
      test: /\.scss$/,
      enforce: 'pre',
      use: 'import-glob-loader'
    }]
  }
};