Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pathname parsing for tracked files #5008

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

peteretelej
Copy link
Contributor

@peteretelej peteretelej commented Jul 18, 2021

The trackModified call in the tracking logic has a bug that incorrectly removes null from pathnames when it tries to remove hash or search values from the parsed path.

Currently:

let pathname = parsed.href.replace(parsed.hash, '').replace(parsed.search, '')

Where if parsed.hash or parsed.search are missing (which is mostly the case for FS files), the value is null
eg { hash: null, search: null}

  • In which case, we essentially trim null
    Converting /mypath/nulldir/file.js -> /mypath/dir/filejs and breaking builds (see JIT Build error  #4920) or potentially accessing the wrong files.

Fix checks if hash or search are set before replacing them

Fixes #4920

The trackedModified call in the tracking logic has a bug that
incorrectly removes `null` from pathnames

Currently:
```
let pathname = parsed.href.replace(parsed.hash, '').replace(parsed.search, '')
```
Where if `parsed.hash` or `parsed.search` are missing (which is
mostly the case for FS files), the value is null
eg `{ hash: null, search: null}`
  - In which case, we essentially trim `null`
converting `/mypath/nulldir/file.js` -> `/mypath/dir/filejs` and
breaking builds (see tailwindlabs#4920 ).

Fix checks if `hash` or `search` are set before replacing them

Fixes tailwindlabs#4920
@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

@RobinMalfait RobinMalfait merged commit 6561708 into tailwindlabs:master Aug 27, 2021
@peteretelej peteretelej deleted the fix/null-dir-build branch August 27, 2021 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT Build error
2 participants