Open jgconway opened 5 years ago
Hi!
Does the alias lookup resolve the right path from path.resolve
? I thought it was a string match and won't execute that method. I could be wrong.
Have you manage to test run your implementation?
From what I can tell, the webpack config is require
'd (see here) so the path.resolve
is actually executed before the string comparison happens. It looks like this is covered in the tests too and, since they're still passing, I guess it's okay.
I did verify that this fix actually solves the problem, i.e. the expected suggestions do show up now. I also can't find any other differences in behaviour before vs after these changes, although obviously there's no guarantee that I've checked every case.
Hi,
So I noticed that no suggestions show up when I try and import from a webpack alias. For example, given the following Webpack config:
If I type
import App from "~/"
then I would expect to see the children ofsrc/
, but in fact I see nothing. It looks like the problem is that the suggestions are being filtered based onprefix
, butprefix
doesn't match any results since they've been transformed by the alias.So my solution is to copy the
massagePrefix
behaviour fromLocalLookup
intoWebpackLookup
, i.e. suggestions will only be matched on the last part of the path. I can't see any reason why this would be a problem, but hopefully someone more familiar with the codebase can confirm that.