webpack / webpack/watchpack

`collectTimeInfoEntries` does not consider case-sensitivity initially

Open
#228 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
400
Forks
111
Avg merge
11h 16m
Merged PRs (30d)
5

Description

The following example is case-sensitive!

Given a file b.tsx:

export default () => <div>ABCDEF</div>

Being imported in a.tsx with the wrong casing:

import B from './B';

export default () => {
  return <B/>
}

Will result in Fast refresh working once, but not twice. This behavior can also be seen in Next.JS, reproduction here: https://github.com/JonnyBurger/watchpack-bug-repro To reproduce, Change the content in Hello.tsx twice.

If a file is imported with the uppercase filename, the watcher will still be registered on the lowercase filename. If the collectTimeInfoEntries function is called, the time info entries for the uppercase names are requested, but they are not in the map and null is returned. Somewhere else in Webpack this leads to the module not being invalidated because null has a meaning of the file not existing at all.

Sending a PR for this!

Contributor guide

Open the contributing guide

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.

Research direction

Start at the collectTimeInfoEntries function and trace how watched filenames are stored and looked up when their casing differs. Use the linked watchpack-bug-repro reproduction, changing Hello.tsx twice; done means repeated changes still invalidate and refresh the imported module with mismatched casing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.