A few examples using
dimport
and its various modes
Here we have a modern TodoMVC application, built with:
There is no bundling or pre-processing of any kind.
All dependencies are declared through import
statements to unpkg.com.
Because of dimport
, we are able to serve this ultra-modern application to all browsers!
The examples below illustrate dimport
's flexibilty, as well as how little needs to change in order to accomodate your support targets.
-
index.html
View Source
Mounts amodule
andnomodule
script tag, each pointing to the same application file. -
inline.html
View Source
Illustratesdimport
's ability to parse inline script text – an alternative todata-main
usage. -
legacy.html
View Source
Allows the ESM-driven application to run anywhere, even in Internet Explorer!*
* While true for
dimport
, this example won't run in IE because its use oflet
, arrow functions, and template literals.
Run a HTTP file server on this directory to explore the samples.
If you do not have any, the local package.json
can install and run a sirv
server for you:
$ npm install
$ npm start
MIT © Luke Edwards