New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwr-js/bootstrap

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwr-js/bootstrap

APIs to bootstrap a LWR root application component

  • 0.0.1-alpha6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Lightning Web Runtime :: Bootstrap

The lwr/bootstrap module provides APIs which are responsible for:

  • importing static application dependencies
  • defining the root application component into the CustomElementRegistry

This results in the root application component being renderable by the DOM on first page load.

Definition

interface BootstrapAPI {
    bootstrap(rootAppSpecifier: string, rootApp: LightningElement): void;
}

Usage

import { bootstrap } from 'lwr/bootstrap';
import xAppRoot from 'x/appRoot';

bootstrap('x/appRoot', xAppRoot);

Configuration

The default lwr/bootstrap module used by an LWR application can be overridden with these steps:

  1. Create a module exporting a bootstrap function which implements the BootstrapAPI interface:
// src/modules/example/bootstrap/bootstrap.js
export function bootstrap(rootAppSpecifier, rootApp) {
    const elementName = rootAppSpecifier.replace(/\//, '-');
    customElements.define(elementName, rootApp.CustomElementConstructor);
}
  1. Configure the module specifier in lwr.config.json:
{
    "modules": [],
    "application": {
        "root": "example/app",
        "bootstrap": "example/bootstrap"
    }
}

FAQs

Package last updated on 12 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc