Reputation: 3241
I'm not clear with the difference between importing a js module by name (like the common react or polymer lit-element usage) or by path (aka npm modules).
What's the difference and why there is a difference in the first place?
Why can't I import lit-element
using:
import { LitElement, html } from 'lit-element'
like a normal npm module and use it in the browser without getting this error: Failed to resolve module specifier. Relative references must start with either "/", "./", or "../".
?
Upvotes: 3
Views: 1809
Reputation: 665546
Using ES6 module syntax in the browser is currently only supported with paths as specifiers because it's not yet clear how bare specifiers are going to get resolved to URLs.
node_modules
folder anywhere.Upvotes: 1