js-dxtools / webpack-validator

Validates your webpack config with Joi
MIT License
295 stars 29 forks source link

'absolutePath' not working for windows environments #131

Closed nyrosmith closed 5 years ago

nyrosmith commented 8 years ago

This line returns true when given 'bla'. But 'bla' is not an absolute path in Windows.

I'd suggest to use path-is-absolute to solve this issue. With this change we also need to adjust configs to give valid/invalid absolute paths.

If it is ok for you I'll provide a PR as it seems I am the only dev in this world who is using this OS on JS OSS.

Related Path issue: https://github.com/js-dxtools/webpack-validator/issues/130

kentcdodds commented 8 years ago

Love it. Let's do that 👍

nyrosmith commented 8 years ago

Regarding to this line const looksLikeAbsolutePath = /^(?!\.?\.\/).+$/.test('exists') is true. But the node documentation says this in not an absolute posix path.

I am really confused now. May it be possible that we don't ask for valid absolute paths at all? Pinging @kentcdodds @bebraw @jonathanewerner for clarification.

jonathanglasmeyer commented 8 years ago

To be honest i'm not 100% positive that "foobar" would classify as an absolute POSIX path -- not sure what my intention was there -- maybe it had something to do with webpack handling a path like "foobar" as an absolute path? Anyways, lets just replace "looksLikeAbsolutePath" with your suggested library path-is-absolute, @nyrosmith -- problem solved, no?

I think checking for absolute paths is a big UX win as this is one of the major confusing parts when configuring webpack -- where to use absolute vs relative paths.