Skip to main content
Deno 2 is finally here 🎉️
Learn more

packup v0.1.4

ci

Zero-config web application packager in Deno.

⚠️ This tool is still in its early development stage.

Features

  • 📦 Bundle web application like Parcel.
  • ✨ Support TypeScript out of the box.
  • 🦕 Deno-compatible ES Modules resolution.
  • 💨 Fast build with esbuild-wasm bundler.

Usage

Install via deno.land/x:

deno run -A https://deno.land/x/packup@v0.1.4/install.ts

Write HTML and JavaScript:

index.html

<html>
<body>
  <script src="./main.ts"></script>
  <h1>Hi from packup!</h1>
</body>
</html>

main.ts

console.log("hello world");

packup has the development server builtin. Run the following command to start the server.

packup index.html

Then open http://localhost:1234/ in your browser.

See packup serve -h and packup build -h for more usages.

Typings

You can type check the script with Deno.

You need the following tsconfig.json for your frontend scripts correctly type checked.

{
  "compilerOptions": {
    "lib": ["esnext", "dom"]
  }
}

If you use vscode you need to set ‘deno.config’ property in .vscode/settings.json file to point the tsconfig.json:

{
  "deno.enable": true,
  "deno.lint": true,
  "deno.unstable": true,
  "deno.config": "./tsconfig.json"
}

If you’d prefer to use CLI directly to type check your script, you can use the following command for it:

deno cache --config tsconfig.json <script>

See the example repository for more details.

Advanced usages

If you want to use packup without installing globally, you can use the following command.

deno run --allow-env --allow-read --allow-write --allow-net=deno.land https://deno.land/x/packup@v0.1.4/ensure_esbuild_wasm.ts
deno run -A https://deno.land/x/packup@v0.1.4/cli.ts <your parameters>

The first command ensures the esbuild wasm installed on your machine. The second command is the actual entrypoint of the packup program.

0.2.0 roadmap

  • twind example
  • Make esbuild.wasm path configurable
  • –public-url
  • optimize (minify) option
  • css import support
  • image import support
  • scss @import support

1.0 roadmap

  • import map support
  • sourcemap support

Prior art

History

License

MIT