simple-bun-build

0.2.7 • Public • Published

simple bun build

Utilities that simplify building Bun projects.

Installation

Run bun add -d simple-bun-build.

Usage

Create a build.ts file at the root of your project.

import { build } from 'simple-bun-build';

build({
  entrypoints: ['./src/some.ts'],
  outdir: './dist',
});

To build your project, run bun run ./build.ts.
You can also add this command to the scripts section of your package.json file.

If you already have a build file you can just replace Bun.build with build. Everything will work the same.

Watch mode

Create a watch.ts file at the root of your project.

import { watchHTML } from 'simple-bun-build';

await watchHTML(
  [
    {
      bunConfig: {
        entrypoints: ['./src/index.ts'],
        outdir: 'dist/test/',
        target: 'browser',
        format: 'esm',
      },
      watchPath: './src/',
    },
  ],
  './test.html',
);

This will listen for changes in the test.html file located in your project root directory and the src directory.
After changes are detected, all browser clients will refresh their page.

Configuration

The build function and the bunConfig field accept the same arguments as the Bun.build function.
Link to the official Bun documentation.

Package Sidebar

Install

npm i simple-bun-build

Weekly Downloads

252

Version

0.2.7

License

MIT

Unpacked Size

11 kB

Total Files

9

Last publish

Collaborators

  • tobilinz