LWC Tooling API Support

Issue #1589 resolved
Daniel Stefan created an issue

Hi,

after the last Major IDEA Update i “finally” upgraded to IC2. I was then working on a LWC and were wondering about the long save time just to notice to my surprise that they are saved via Metadata API.

I only found your Note on the initial LWC Support Release Notes that it seems to be case that no Tooling API Equivalents existed. Could that potentially have changed? For the same Reason i had written a custom plugin for VS Code which were using LightningComponentBundle / LightningComponentResource and it seemed to work fine to me.

Is there something I may miss? Otherwise i would love to see Tooling API support for LWC inside of IC2 as i sometimes are sitting like 5 minutes for a change in front of the screen (and also in general much longer than i am used to from vs) 🙂

Official response

  • Scott Wells repo owner

    An issue has been found with Tooling REST API-based deployment of LWC bundle files. It's the same issue reported here:

    https://github.com/msrivastav13/DX-Code-Companion/issues/15

    I have spoken with Salesforce and they are aware of the issue and tracking it internally, but there's currently no ETA for a fix. As a result, tomorrow morning's build--2.1.2.2--will add an explicit configuration option for Tooling API-based deployment of LWC bundle files, distinct from the same option for Aura. The LWC option will be disabled by default due to these issues, though if you're not affected by these issues in some/many components, you can enable Tooling API-based deployment for LWC.

    I'm going to research other LWC deployment optimizations over the next few weeks. Hopefully I'll find and implement one that's free of these types of issues shortly.

Comments (14)

  1. Scott Wells repo owner

    Hi, Daniel. I'll have to take a look. LWC bundles still aren't supported as Tooling API metadata container contents, but it does look like they could be managed now in the same manner as Aura bundle files. That would dramatically speed things up when working with the individual files. I'll put this on my near-term list.

  2. Scott Wells repo owner

    An issue has been found with Tooling REST API-based deployment of LWC bundle files. It's the same issue reported here:

    https://github.com/msrivastav13/DX-Code-Companion/issues/15

    I have spoken with Salesforce and they are aware of the issue and tracking it internally, but there's currently no ETA for a fix. As a result, tomorrow morning's build--2.1.2.2--will add an explicit configuration option for Tooling API-based deployment of LWC bundle files, distinct from the same option for Aura. The LWC option will be disabled by default due to these issues, though if you're not affected by these issues in some/many components, you can enable Tooling API-based deployment for LWC.

    I'm going to research other LWC deployment optimizations over the next few weeks. Hopefully I'll find and implement one that's free of these types of issues shortly.

  3. Jurgis Salna

    Any clues why aura/lwc deployements don’t work on my setup? Seems to be going thru sfdx.

  4. Scott Wells repo owner

    Jurgis, when you say "don't work", what's happening? Are you getting an error? Is it silently not doing anything?

    I'd likely need to see a debug log to know for sure. Can you please enable debug logging for metadata deployment, reproduce the behavior, and then email the resulting idea.log file to support@illuminatedcloud.com for review?

  5. Jurgis Salna

    @Scott Wells No error, but deploy seems to be happening via sfdx. Perhaps I misunderstand the feature?
    Does this works with sfdx based repos? I wanna use tooling API because how fast it used to save in dev console. But perhaps I’m missing something (hence screenshot)?

    I’ve tried to gather debug logs but nothing seems to get collected - idea.log file didn’t get created.

  6. Scott Wells repo owner

    Jurgis, there must be an idea.log. That's generated all the time when the IDE is running. Did you try using Help>Show Log in Explorer/Finder/Files to locate the log file(s)?

  7. Scott Wells repo owner

    I've just committed a change that determines whether an LWC JavaScript file is requested for deployment and, if so, whether it contains the type of import that yields a FIELD_INTEGRITY_EXCEPTION, specifically an import of a custom field or any field from User. In that situation, deployment occurs via the Metadata API. This should result in faster LWC dev time more often.

    I've also changed the default for LWC Tooling API deployment back to enabled, and I've removed the warning that was displayed when enabling that option.

    It's possible that there are other types of fields that fail in this manner. If so, what I plan to do is add them to the patterns used to recognize these imports with the goal of having this be a 100% reliable mechanism for determining the most efficient deployment path for individual LWC bundle files.

    This change will be included in the next official build.

  8. Log in to comment