A minimal TypeScript setup with file watching and serving. No bundling!
Disclaimer: This is a "I want to try something out right now" template, it may not fit your production needs.
npm install
npm start
There is no build system other than the TypeScript compiler generating ES2017 .js
files. This means that only browsers that natively support modules are supported.
The only caveat is that import
statements should use the .js
suffix, so that the browser can make sense of them once compiled, e.g.
import { onReady } from "./onReady.js";
All files in src
(other than .ts
or .js
) are watched with chokidar-cli and rsync
'd to dist
when changed.
Files are served with Browsersync, serving options can be customised in bs-config.js
.
Compared to the defaults: .wasm
files are served with the correct MIME type, and the timeout has been massively increased.
npm run start
- build, watch and serve the projectnpm run build
- create a fresh build, no watching or servingnpm run lint
- run the linter
Other utility commands can be found in package.json