Use Base Lightning Web Components with LWR on Node.js
Use base Lightning web components with your LWR application by setting up the lightning-base-components package.
Include the Salesforce Lightning Design System ("SLDS") with your app before setting up your app for base Lightning web components.
Before you begin, make sure you have already set up SLDS with your app.
To use base Lightning web components in an LWR application:
- Create a dependency on
lightning-base-components
by adding it to adevDependencies
section inpackage.json
:
- Make the
lightning-base-components
npm package available to your LWR app inlwr.config.json
:
-
If you’re creating your own layout template, include the
lwr_resources
context object property. (If you’re not creating your own layout template, LWR creates a default template for you that already includeslwr_resources
.) -
Start using base Lightning web components!
Run the following terminal commands from the root of your project:
Open the site at http://localhost:3000. Read Get Started with LWR for details on LWR's Yarn commands.