This page in the LWC developer guide talks about a component JS file, in particular:

Every UI component must include a JavaScript file with at least this code.

import { LightningElement } from 'lwc';
    export default class MyComponent extends LightningElement {

The core module in Lightning Web Components is lwc. The import statement imports LightningElement from the lwc module.

import { LightningElement } from 'lwc';

LightningElement is a custom wrapper of the standard HTML element.

Presently I'm learning about JS modules and importing/exporting them. I understand that they are individual JS files.

So is there a way to see the lwc module referenced in the documentation? If possible, what is in it and what does it look like?

2 Answers 2


Edit (2019-05-30): LWC is now open source! https://github.com/salesforce/lwc

Our intent is to open source LWC by the end of the year but it will ultimately come down to resourcing constraints because there's still a lot of work to do!

There's not too much going on in the lwc module. There's basically LightningElement which exposes an API subset of HTMLElement (what we consider the "good parts"). There are also the various decorators (api, track, readonly, wire) and several other APIs that are only usable by our compiler.

To answer your question though, a single file would be the simplest type of module, but a module can contain multiple files since we are able to import and export in the same file. You can event do that with a single line using module redirects.

  • Would be great if it was developed in the open like salesforce lightning design system on github. The distribution is public on npm.
    – pfeilbr
    Commented Mar 25, 2019 at 19:51

So is there a way to see the lwc module referenced in the documentation?

Not that I know of.

Unlike Lightning Aura Components, which was built on top of Open Source Aura Framework, Lightning Web Components model at least as of today is not Open Sourced. This is more of a platform implementation for Web Standards and that unless Salesforce opens it up, there's no way of accessing any base code implemented in the LWC model.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .