lukeed / lukeed/webpack-plugin-replace
Produces undefined if `values` is empty or undefined
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
If values is not specified result is always a bunch of undefined
new ReplacePlugin({
include: /serviceManager/,
patterns: [
{
regex: /var IS_WEB = [^;]+;/,
value: 'var IS_WEB = true;'
}
]
})
Calls on file content:
mod._source._value.replace(/(?:)/g, k => vals[k]);
Can be easily fixed:
if(keys.length) {
mod._source._value.replace(REGEXP, k => vals[k]);
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the ReplacePlugin implementation that builds the replacement regular expression and invokes replace on the file content. Reproduce the issue with the configuration shown and verify that an empty or undefined values collection leaves the original content unchanged rather than producing undefined output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100