Bundle.js

Bundle.js API Documentation

Comprehensive documentation for all public APIs and configuration options.

Core APIs
On This Page

Core API Reference

build(input, output)

Main bundling function that compiles and outputs files.

{ input: 'src/index.js', output: 'dist/bundle.js' });

watch(files, callback)

Watches files and triggers rebuilds on changes.

watch(['src/**/*'], () => build(...) });

Configuration Options

Config Object

Property
input
Type
string
Description

Path to entry file

Plugin System

Plugin Structure

{ name: 'my-plugin', apply: () => ({ transform(source) { ... } }) }

Built-in Plugins

  • typescript()
  • esbuild()

Utility Functions

resolve moduleId

Resolve module paths with custom aliasing

resolve('./components/button');

analyze(bundle)

Create bundle analysis report

analyze({ bundle: 'dist/bundle.js', stats: 'report.json' });

minify(content)

Terser-based code minification

minify({ code: 'function add(a,b) { return a+b }', output: 'add-min.js' });

Need More Help?

Explore our API sandbox or join the Discord community to get live answers from developers.