Skip to main content
2 of 3
added 107 characters in body
RomanK
  • 73
  • 1
  • 1
  • 7

Access LWC via URL

Is there a way how to access LWC component via URL?

As a playground I'm using https://github.com/trailheadapps/lwc-recipes and want to access WireCurrentPageReference component.

I've tried https://enterprise-computing-1068-dev-ed.lightning.force.com/lightning/cmp/c__wireCurrentPageReference, but all I've got is the "This page isn't available in Salesforce Lightning Experience or mobile app." error message, as if I did specify component name that does not exist.

As you could see in lwc-recipes repos, the wireCurrentPageReference.js-meta.xml file does have all of the necessary targets:

<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

Bonus question, if there is a way to access it via URL, will URL query parameters be shown in a component?

UPD: per Phil W answer it is not possible. I will have to create a page and put the component there

RomanK
  • 73
  • 1
  • 1
  • 7