This post contains content about Now 1.0 – Learn about the latest version, Now 2.0.
Now 2.0 - Upgrade Available
<script type="module">to load your scripts. The file can end in
.mjs. However, a lot of web servers and hosting solutions have never heard of
mjs, so they use the wrong
Content-Typewhen serving your files. The specification mandates that, unlike regular scripts, module scripts must be served with a valid JS Content-Type.
file://protocol is quite problematic. On both Chrome and Firefox the example above won’t run.
servetool, which sets up a HTTP server on
localhostthat simply serves your files. Starting with the newly released serve 6.2.0, the
Content-Typeis correctly handled. Run
npm install -g serveto get the latest, and then run the
servecommand inside any directory.
/_srcat the end of the URL. To give you the best experience, we’ve also upgraded our web viewer to recognize mjs: