Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

fix: encoded spaces in pathname #106

Merged
merged 2 commits into from
Mar 19, 2021

Conversation

anuraghazra
Copy link
Contributor

fixes #22

@@ -183,8 +182,7 @@ function trackModified(files) {
let changed = false

for (let file of files) {
let pathname = url.parse(file).pathname
let newModified = fs.statSync(pathname).mtimeMs
let newModified = fs.statSync(file).mtimeMs
Copy link
Contributor Author

@anuraghazra anuraghazra Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way we can fix this is by decoding the URI component.

    let pathname = url.parse(file).pathname
    let newModified = fs.statSync(decodeURIComponent(pathname)).mtimeMs

but I think just that file variable will also work, I'm not sure about why url.parse is used here. as mentioned in #22 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! The reason we parse it is because in Vite, the path will often have query params like:

/Users/adam/code/my-project/src/App.vue?style=blah

...and trying to do a statSync call on that will file if we don't just grab the real file path. So I think the decodeURIComponent solution is probably the right move 👍 Thanks so much for this PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Okay i will then change it to use decodeURIComponent

@adamwathan adamwathan merged commit b3d2593 into tailwindlabs:main Mar 19, 2021
@adamwathan
Copy link
Member

Merged, will tag this in a little bit, thank you! 🙌

@anuraghazra anuraghazra deleted the windows-path-fix branch March 20, 2021 06:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

css-loader can't handle paths with spaces
3 participants