Bundle, test, lint and format TypeScript with only Deno and esbuild. No Node needed!
You only need two executable files to write TypeScript for the browser: Deno and esbuild.
- Remember Deno needs file extensions, for example;
import { example } from "./src/main.ts";
These are taken care of by esbuild in the bundling.
There is no need for Node anymore, you can import packages via URL's with their types using https://cdn.skypack.dev/package-name
Bundle and minify for the browser using Deno and the official esbuild plugin
To build a development bundle from src/main.ts
and serve to a your default browser on Linux/Mac:
./build-watch.js
- It will rebuild and reload dev server when any file in
./src
is modified - The contents of
./static-assets
will be copied to thedist
folder on rebuild
run ./test-watch.sh
to execute all tests in the /test
directory.
Remember Deno has no DOM but many browser compatible API's
To run Deno LSP in Neovim 0.5+ with linting and DOM types enabled via deno.jsonc
:
nvim_lsp.denols.setup({
on_attach = on_attach,
init_options = {
config = "./deno.jsonc",
lint = true,
},
})
THANKS to https://github.com/dalcib from evanw/esbuild#802 (comment) for original code.