Run Deno code in the browser. Fast & simple.
Discord
dsbuild is a simple, fast static site builder.
It compiles any Deno TypeScript (or Markdown) into a single JavaScript file that can be run in the browser.
It’s a one-command, zero-configuration way to build React, Markdown, or other JS-powered web sites entirely using Deno.
Features:
- Supports TypeScript, MDX (Markdown), JSX, and React out of the box.
- Automatic rebuilds as you develop (
dsbuild --watch) - Previewing via a simple included web server (
dsbuild --serve) - URL imports using
https://,file://,npm:,jsr:, and import maps. - Full support for Deno syntax and modules that don’t require the
Denonamespace or system APIs. - Powered by
esbuildandesbuild_deno_loaderunder the hood.
Installation
Install the Deno runtime.
Run the following command to install dsbuild:
deno install -frAg -n dsbuild https://deno.land/x/dsbuild/mod.ts- Ensure
$HOME/.deno/binis in yourPATHenvironment variable.
Usage
See examples/ for full examples of building React, Markdown, or other JS-powered web sites.
dsbuild- Run this command from any directory to compile
src/app.tsintopublic/app.js.
- Run this command from any directory to compile
dsbuild --watch(ordsbuild -w)- Watches
src/directory and rebuilds on changes.
- Watches
dsbuild --watch --serve(ordsbuild -ws)- Watch and serve
public/onlocalhost:8000.
- Watch and serve
dsbuild --import-map import-map.json- Builds with import map.
dsbuild --denoconfigGenerates a deno.json you can use for Deno development with proper
targetandlibsettings for Browsers/React/JSX.You can also run
dsbuild --denoconfig --out deno.jsonto write to a file.
dsbuild --tsconfigGenerates a tsconfig.json you can use for Deno development with proper
targetandlibsettings for Browsers/React/JSX.You can also run
dsbuild --tsconfig --out tsconfig.jsonto write to a file.
dsbuild --in src/some-file.ts --out public/another-file.jsYou can configure the
inandoutflags to customize the input and output files.These example values are the same as the defaults when you call
dsbuild.
dsbuild --target chrome99,firefox99,safari15- Customize the output target, to specify browsers or a different environment. (esbuild target docs)
dsbuild --serve-only- Serve
public/onlocalhost:8000without building.
- Serve
DENO_ENV=development dsbuild- Builds without minification.
Quick Start
Check out the examples/ folder for a demo, after git clone-ing this repo and
installing dsbuild.
Inside the folder, run dsbuild --serve --watch, make changes to src/app.ts,
and you should see the page immediately update.
Contributors
Feel free to contribute to this project.
License
MIT license.