Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Produces undefined if `values` is empty or undefined

Open
#6 0 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, webpack
Domain
build-system

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.

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]);
}
Dominant language
JavaScript
Stars
36
Forks
8
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lukeed/webpack-plugin-replace

All issues in lukeed/webpack-plugin-replace

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.