Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
interpolateName
✓ import { interpolateName } from 'loader-utils'
✗ const interpolateName = require('loader-utils/interpolateName')
Named export; always import from the package root.
urlToRequest
✓ import { urlToRequest } from 'loader-utils'
✗ import urlToRequest from 'loader-utils'
Named export, not default export.
getHashDigest
✓ import { getHashDigest } from 'loader-utils'
✗ import * as loaderUtils from 'loader-utils'; const { getHashDigest } = loaderUtils
Can destructure but named import is fine.
Demonstrates importing and using urlToRequest, isUrlRequest, and interpolateName in a webpack loader.
import { interpolateName, urlToRequest, isUrlRequest } from 'loader-utils';
function myLoader(loaderContext, content) {
if (isUrlRequest(content)) {
const request = urlToRequest(content, '~');
// ...
}
const name = interpolateName(loaderContext, '[name].[contenthash:hex:8].[ext]', { content: Buffer.from(content) });
return name;
}
Debug
Known issues
breakingPrototype pollution vulnerability in versions <=2.0.2 and <=1.4.0. CVE-2022-37601.fixUpgrade to v2.0.4+ or v3.x.
affects: <=2.0.2 || <=1.4.0
breakingReDoS vulnerability in versions <3.2.1, <2.0.4, <1.4.2.fixUpgrade to latest version in each major: v3.3.1, v2.0.4, v1.4.2.
affects: <3.2.1 || <2.0.4 || <1.4.2
deprecatedgetOptions has been deprecated in v3.x. Use loaderContext.getOptions() instead.fixReplace getOptions calls with loaderContext.getOptions() or use webpack's built-in.
affects: >=3.0.0
deprecatedparseQuery has been deprecated. Use URLSearchParams or the standard query parser.fixReplace parseQuery with new URLSearchParams(query).
affects: >=3.0.0
gotchainterpolateName's [hash] uses xxhash64 by default in v3+. Previous versions used md4. This can cause unexpected hash output differences when upgrading.fixSpecify hash type explicitly, e.g., [hash:md4:hex] for backward compatibility.
affects: >=3.2.0
gotchaurlToRequest with root starting with '~' now treats it as module request. Previously only URL starting with '~' was treated as module. Behavior changed subtly in v3.fixReview usages where root parameter is passed to urlToRequest.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: loaderUtils.getOptions is not a function
getOptions was removed in v3.x.
fixUse loaderContext.getOptions() instead.
Error: Cannot find module 'loader-utils/parseQuery'
parseQuery is no longer exported in v3.x.
fixRemove the import; use built-in URL parser or query string splitting.
Warning: [contenthash] is deprecated, use [fullhash] instead
Using [contenthash] in webpack 5+ but loader-utils interpolateName uses its own hashing.
fixUse [fullhash] in webpack configuration for full chunk hash, or use [contenthash:xxhash64:hex] in loader-utils.
Audit
Dependencies
No dependency data recorded yet.