Context
src/index.js uses Object.assign(DEFAULTOPTIONS, loaderUtils.getOptions(this)), which mutates the shared DEFAULTOPTIONS object across loader invocations. It also parses width/height with parseInt() without validation, which can yield NaN and still calls gm.resize().
Why this matters
Shared mutation can leak configuration between builds/runs, and invalid options can lead to confusing failures or unexpected output sizes.
Proposal
- Avoid mutating defaults by cloning options.
- Validate numeric width/height and provide clear errors or fallbacks.
- Use an explicit radix in
parseInt or Number() with Number.isFinite checks.
Tasks
Context
src/index.jsusesObject.assign(DEFAULTOPTIONS, loaderUtils.getOptions(this)), which mutates the sharedDEFAULTOPTIONSobject across loader invocations. It also parses width/height withparseInt()without validation, which can yieldNaNand still callsgm.resize().Why this matters
Shared mutation can leak configuration between builds/runs, and invalid options can lead to confusing failures or unexpected output sizes.
Proposal
parseIntorNumber()withNumber.isFinitechecks.Tasks
Object.assign({}, DEFAULTOPTIONS, loaderOptions)(or spread).max-width/max-heightand handle invalid values (error or skip resize).