What's new with Lightning Web Components?
Oli Lane on June 21st 2019
In the Spring ‘19 release, Salesforce introduced a new way of creating Lightning components - Lightning Web Components (LWC). In a blog post at the time, we explained what LWC are and what benefits they offer Salesforce developers - but in the months since, there's been lots of exciting news.
Lightning Web Components is getting local development support
While developing with Lightning Web Components is already a good experience, there's always room for improvement. One of the main limitations at the moment is that you can't run your components locally. When you want to run your code, you have to push it into Salesforce. Although scratch orgs and many parts of the DX tooling make this easy to do, it still lengthens the feedback loop and slows down development.
The good news is that, with the announcement of Local Development for Lightning Web Components, the lack of local build support won't be an issue anymore. You'll be able to run your components locally as well as connect them to a live org to test with real data. In other words, you can iterate rapidly without losing the benefits of building and testing in an environment close to production.
Local Development for Lightning Web Components isn't available yet, but there's an upcoming webinar to preview the new tool, which should enter Open Beta in the summer.
The Lightning Web Components framework is now open source
At the end of May, Salesforce announced that it will open source the LWC framework. We think this is a great move, for several reasons:
- Developers get greater visibility and input into the roadmap and the development process.
- Trust and transparency help engage the community and result in a greater likelihood that the right features get built and prioritized effectively.
- Developers can gain a deeper understanding of the framework by reading the source code, contributing to the documentation where it's lacking, and getting insight into the development process.
- The open sourcing of LWC should give developers the confidence to use LWC for projects outside of the Salesforce platform, especially once a community develops around this modern framework.
Lightning Web Components is getting easier to use outside of Salesforce
Speaking of using Lightning Web Components outside of Salesforce, that's getting easier too! The LWC framework has no dependencies on the Salesforce platform - it's based directly on modern web standards. All of the integration with the Salesforce platform builds on top of the framework, which means you can use the framework independently of the platform.
If you want, you can build a complete web app that's unrelated to Salesforce using Lightning Web Components. There are a host of benefits to this, including for Salesforce developers:
- It allows you to carry over all your front-end development skills from Salesforce to other web development roles. So you can learn one set of skills - essentially modern front-end development practices - and use those skills whatever project you're working on.
- You can use a single framework everywhere and share code in apps that have some aspects in Salesforce with other aspects that are not. For example, if your application has a Salesforce interface and a web interface hosted on Heroku (or anywhere else), you can use Lightning Web Components throughout.
The 'lwc-create-app' tool and other useful LWC resources
It's got much easier to get started on building a standalone web app with Lightning Web Components thanks to a new tool called
lwc-create-app. If you're familiar with
create-react-app, you'll notice the similarities. After installing
lwc-create-app, you only have to run a couple of CLI commands to generate a fully working template for a web app based on the LWC framework, including a build process, a local development server and a test framework.
There's a new developer site for the LWC framework, where you can find more information about building apps and components of your own, along with information on how to use the
lwc-create-app tool. As usual, the Salesforce developer documentation is a great resource, too.
If you're interested in the source code for the LWC framework itself, you can find it on GitHub here.