-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
All imports unresolved when using PowerShell #263
Comments
Wild. I have no idea. I would guess something to do with the working directory (see recent Webpack resolver issues for some detail). I am completely unfamiliar with PowerShell, though. Hopefully someone else has an idea. 😅 |
I figured out the problem. It was a case sensitivity issue. I had cd'd into my project directory in Powershell without using the proper casing. For example, on disk the path was The following condition in if (filenames.indexOf(basename(filepath)) === -1) {
result = false
} else {
result = fileExistsWithCaseSync(dir, cacheSettings)
} I dug a little deeper and checked the code for win32.basename = function(path, ext) {
var f = win32SplitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
}; I'm guessing that the TODO in there (as well as a quick glance at the code) means that the current version of that function is case sensitive, and is possibly contributing to this situation. I'm not sure if this is an issue or not with the code in eslint-plugin-import or more of an issue with the path module. Feel free to close this if you take a look and decide it's not an issue with this plugin. If you want to reproduce this issue, you can fire up powershell and cd into the project directory using incorrect casing and run the tests in this module - all of the resolve tests will fail. If you need any more information, please let me know, I'm happy to help. Thanks! |
I think I will close this issue for now, seems like something that would be solved by making case-sensitive resolution optional. |
I could not figure out why all of my imports were showing as unresolved until I ran eslint in a normal command prompt rather than PowerShell. In PowerShell, all of my imports show up as unresolved, but when I run it at a normal command prompt, there are no errors.
In PowerShell, it doesn't resolve modules from node_modules directory, nor my local imports:
Has anyone experienced this, or know why this is happening? I assume it has to do with relative pathing and how PowerShell interprets them.
Edit: Forgot to say, when I hardcode the full path to a module that I am importing (c:\projects\src...), it works fine in PowerShell. It appears to be the relative paths and node_modules that do not work.
The text was updated successfully, but these errors were encountered: