webpack-glob-entry
raw JSON → 2.1.1 verified Sat Apr 25 auth: no javascript maintenance
A utility function for webpack that converts glob patterns into entry objects, allowing multiple entry points to be specified via globs. Current stable version is 2.1.1, with no updates since January 2017. It simplifies webpack configuration by automating entry point discovery, supporting custom entry name functions and base path extraction. Unlike manual entry arrays or other glob plugins, it integrates directly into the entry field and provides helper functions for path manipulation. However, it has not been updated for webpack 4/5 and may have compatibility issues.
Common errors
error entry is not a function ↓
cause Using ES import syntax with this CommonJS-only module.
fix
Use const entry = require('webpack-glob-entry')
error Cannot find module 'webpack-glob-entry' ↓
cause Package not installed or incorrect module path.
fix
Run npm install webpack-glob-entry --save-dev
error TypeError: Cannot destructure property 'entry' of ... undefined ↓
cause Using destructured import on the default export.
fix
Use const entry = require('webpack-glob-entry') without destructuring.
Warnings
breaking In v2.0.0, entryNameFn now takes only one parameter (file path), not the previous two (file path and index). ↓
fix Update custom entry name functions to accept a single argument; remove the unused index parameter.
gotcha Package has not been updated since 2017; it may not be compatible with webpack 4 or 5 (e.g., entry object expectations). ↓
fix Test with your webpack version; consider alternatives like 'glob' with manual entry mapping.
gotcha The entry function expects glob patterns as separate arguments, not an array. Passing an array will cause incorrect behavior. ↓
fix Use spread: entry(...globArray) or call entry with multiple string arguments.
Install
npm install webpack-glob-entry yarn add webpack-glob-entry pnpm add webpack-glob-entry Imports
- entry wrong
import entry from 'webpack-glob-entry'correctconst entry = require('webpack-glob-entry') - entry.basePath wrong
const basePath = require('webpack-glob-entry').basePathcorrectconst entry = require('webpack-glob-entry').basePath - entry (default) wrong
const { entry } = require('webpack-glob-entry')correctconst entry = require('webpack-glob-entry')
Quickstart
const entry = require('webpack-glob-entry');
const path = require('path');
module.exports = {
entry: entry('js/*.entry.js'), // converts to { 'js/some': './js/some.entry.js' }
output: {
path: path.resolve(__dirname, 'public/build'),
filename: '[name].bundle.js'
}
};