A webpack loader that exposes a module (in whole or in part) to the global object (window/global/self). Current stable version is 5.0.1, with regular maintenance releases. It is part of the webpack-contrib org and the recommended shimming solution for exposing third-party libraries to global scope. Key differentiators: supports granular exposure of specific exports, multiple global names, and override control. Alternative approaches like ProvidePlugin only add variables to modules, while this loader actually attaches to the global object for browser compatibility.
npm install expose-loaderVerified import paths — ran on the pinned version, not inferred.
Configure expose-loader in webpack config to expose jQuery as $ and jQuery globally, then import jquery in entry point.
Update inline query to use comma-separated values: `exposes=$,jQuery`
Upgrade Node.js to >=18.12.0 or pin expose-loader to v4.x.
Use webpack 5 or later; if on webpack 4, use expose-loader@1.
Use %20 for spaces in URLs: e.g., `exposes=_.map|map` (no spaces) vs `exposes=_.reduce|reduce` (no spaces).
Use `test: require.resolve('module-name')` to precisely match the module path.Run `npm install --save-dev expose-loader`.
Ensure webpack config has a rule with `test: require.resolve('your-module')` and `loader: 'expose-loader'`.Check the `exposes` option: it should be a string, object, or array of those, not a number or boolean.