0.2.3 • Published 2 years ago
simple-bun-build v0.2.3
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.