modular-template-esm-view
v2.0.0
Published
This is a [Modular ESM View](https://modular.js.org/package-types/esm-view)
Downloads
6
Readme
PackageName__
This is a Modular ESM View
Build
To build your ESM View for deployment, run:
modular build PackageName__
The resulting output is an optimized site that can be served statically or
imported at run-time using
dynamic import.
All code (files in src
plus external dependencies required in the code) is
bundled in a single blob of code that can be split in different files, except
for external dependencies that are re-written to an ESM CDN (this behaviour is
configurable).
Start
To run your ESM View locally on a development server, run start:
modular start PackageName__
This causes a developer server to run on port 3000, serving the ESM View with an additional runtime layer that provides a trampoline module to load the generated files, plus developer experience functionalities like hot reloading and on-screen error overlay. Please make sure that your ESM View entry-point exports a React component as default for this to work.
Entry-point
ESM-Views need an entry-point file located at src/index.tsx
, which typically
exports a React component as default for the synthetically generated
index.html
and the start
command to work.
Template
ESM Views are generated by modular add
using the
modular-template-esm-view
template.