Import modules

from npm

Bare imports (not starting with ./, ../, http:.// or https://) are sourced automaticaly from npm. No npm install required.

import { render } from 'lit-element';

Latest version of the dependency is used unless you define dependencies in package.json.

from URL

import { render } from 'https://unpkg.com/lit-element';

from inside Design-System

On component A, you can access component B by relative import:

import '../../component-B/src/module.js`;

But we recommend to use an alias for convenience.

tsconfig.json

{
  "compilerOptions": {
    ...
    "paths": {
      "~/*": ["*"],
    }
    ...
  }
}

This allows

import '~/component-B/src/module.js`;

Import CSS

See CSS, Sass or Less for the different ways to import in stylesheet files.

Importing Asset as String

Assets can be imported as strings using the ?raw suffix.

import imageSVG from './image.svg?raw';