{"id":20779,"library":"webpack-import-glob-loader","title":"webpack-import-glob-loader","description":"Webpack preloader that expands glob patterns in ES6 import statements (e.g., `import './foo/**/*.js'`) into individual named imports before bundled. Current version 1.6.3, maintained with occasional updates. It works as a Webpack loader, transforming source code at build time. Differentiates from alternatives like `bulk-import` by focusing on Webpack loader integration and supporting side-effect imports (e.g., `import './**/*.scss'`) and Sass `@import` globs. Use it as a preloader or chained loader.","status":"active","version":"1.6.3","language":"javascript","source_language":"en","source_url":"https://github.com/fred104/webpack-import-glob-loader","tags":["javascript","webpack","loader","glob","es6"],"install":[{"cmd":"npm install webpack-import-glob-loader","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-import-glob-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-import-glob-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"why":"Webpack loader utility for parsing loader options and generating context","package":"loader-utils","optional":false},{"why":"Pattern matching to resolve glob expressions in import paths","package":"glob","optional":false}],"imports":[{"note":"This is a Webpack loader, not a JS module. Do not import directly in application code.","wrong":"import globLoader from 'webpack-import-glob-loader'","symbol":"Loader (no direct export)","correct":"Configure in webpack config: use: 'webpack-import-glob-loader'"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        use: 'webpack-import-glob-loader'\n      }\n    ]\n  }\n};\n\n// In your source code:\nimport modules from \"./foo/**/*.js\";\n// Expands to:\n// import * as module0 from \"./foo/1.js\";\n// var modules = [module0, ...]","lang":"javascript","description":"Webpack configuration to use the loader as a preloader for .js files, enabling glob imports."},"warnings":[{"fix":"Ensure this loader runs first (as preloader) or before transpilers like Babel.","message":"Loader expands imports before other loaders; order matters in rule chains","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use only with static import statements; dynamic imports will not be transformed.","message":"Glob patterns only work for static imports, not dynamic import()","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Update to latest version; if using Webpack 5, ensure loader-utils version is compatible (v2+).","message":"Webpack 4 compatibility; may need peer dep adjustments","severity":"deprecated","affected_versions":"<1.6"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install webpack-import-glob-loader --save-dev` and check the rule's use value.","cause":"Loader not installed or incorrectly specified in webpack config.","error":"Error: Couldn't find loader 'webpack-import-glob-loader'"},{"fix":"Place webpack-import-glob-loader earlier in the rules array or use `enforce: 'pre'`.","cause":"Loader not applied before Babel or other transpilers due to rule order.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader"},{"fix":"Move import statements to top level; glob expansions require static analysis.","cause":"Using glob import inside a function or callback instead of top-level import.","error":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}