LWC module auto-import path resolution incorrect

Issue #2482 resolved
Matej Mercina created an issue

When using shared methods implemented in service LWC components, autocomplete will correctly find the method and add the import declaration. However, the import path will be incorrect. Instead of adding, i.e. import { displayErrorNotification } from "c/notificationUtilities"; it will add import { displayErrorNotification } from "../notificationUtilities/notificationUtilities"; This will cause the component to fail to deploy. Ideally, the import auto-complete should take into account Salesforce specifics.

Comments (9)

  1. Scott Wells repo owner

    Hi. Can you please confirm that you’re on the latest build of IC2 (currently 2.2.9.5)? This should have been resolved with #2354 in 2.2.7.8. If you still see the same behavior after ensuring that you’re up-to-date, please let me know.

  2. Scott Wells repo owner

    I'm going to resolve this assuming(/hoping) that it was originally reproduced on an earlier version. If it's still reproducible on the latest version, please reopen with the specific use case.

  3. Matej Mercina reporter

    @Scott Wells apologies for the very late reply, I completely forgot about this. Unfortunately, the issue is present in v2.2.9.8

    Here’s what’s I’m getting:

  4. Scott Wells repo owner

    Thank you. Can you please create a simple standalone project with just these two components – it’s fine if everything required to reproduce the issue is just stubbed – and attach it here so that I can try to reproduce it in the exact same context in which you’re seeing it?

  5. Matej Mercina reporter

    @Scott Wells I can confirm this works correctly now, with one exception. It appears namespaced orgs will have that namespace used instead of the “c/” namespace. The explicit use of namespace is currently not allowed however.

  6. Scott Wells repo owner

    Thanks for letting me know about that instance of the issue. I’ve just committed a fix for the next build.

  7. Log in to comment