Context
The loader currently uses loader-utils@^1.2.3 with loaderUtils.getOptions(this) and loaderUtils.parseQuery(this.resourceQuery). Both are legacy patterns; webpack5 prefers this.getOptions() and URLSearchParams-based parsing. Keeping compatibility helps modern projects.
Why this matters
Improves compatibility with webpack5 and reduces reliance on deprecated loader-utils APIs.
Proposal
- Support
this.getOptions() when available, with a fallback for older webpack versions.
- Replace
loaderUtils.parseQuery with URLSearchParams (or a lightweight parser) for resourceQuery.
- Consider upgrading or removing the dependency on
loader-utils if no longer needed.
Tasks
Context
The loader currently uses
loader-utils@^1.2.3withloaderUtils.getOptions(this)andloaderUtils.parseQuery(this.resourceQuery). Both are legacy patterns; webpack5 prefersthis.getOptions()and URLSearchParams-based parsing. Keeping compatibility helps modern projects.Why this matters
Improves compatibility with webpack5 and reduces reliance on deprecated loader-utils APIs.
Proposal
this.getOptions()when available, with a fallback for older webpack versions.loaderUtils.parseQuerywithURLSearchParams(or a lightweight parser) forresourceQuery.loader-utilsif no longer needed.Tasks
const loaderOptions = this.getOptions ? this.getOptions() : loaderUtils.getOptions(this).this.resourceQueryvianew URLSearchParams(this.resourceQuery)and coerce numeric values.