{"library":"imports-loader","type":"library","category":null,"description":"A webpack loader that automatically injects import/require statements for global variables into modules, enabling third-party code that depends on globals like $ or this to work with webpack's module system. Current stable version is 5.0.0 (January 2024), released under the webpack-contrib organization. It supports inline query syntax and webpack config rules, offering fine-grained control over import type (ESM, CommonJS), variable names, and module aliases. Key differentiators: explicit control over shimming via loader query parameters, support for named and default imports, and ability to wrap code in an IIFE with custom arguments. Requires webpack 5 and Node 18.12+. Releases follow semver with major bumps for Node and webpack version requirements.","language":"javascript","status":"active","version":"5.0.0","tags":["javascript","webpack"],"last_verified":"Wed May 27","install":[{"cmd":"npm install imports-loader","imports":["module.exports = { module: { rules: [ { test: /example\\.js$/, use: [{ loader: 'imports-loader', options: { imports: ['default jquery $'] } }] } ] } }","const myLib = require(`imports-loader?type=commonjs&imports=single|jquery|$&wrapper=window!./example.js`);","import myLib from 'imports-loader?imports=named|library|myMethod,angular!./example.js';","import myLib from 'imports-loader?additionalCode=var%20myVariable%20=%20false;!./example.js';"]},{"cmd":"yarn add imports-loader","imports":[]},{"cmd":"pnpm add imports-loader","imports":[]}],"homepage":null,"github":"https://github.com/webpack-contrib/imports-loader","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/imports-loader","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/imports-loader/compatibility"}}