Skip to main content

plain.esbuild

Build and bundle JavaScript files using esbuild.

Overview

Plain esbuild provides a simple way to bundle JavaScript files using esbuild. Any asset file with .esbuild. in its name will be automatically bundled into a corresponding .esbuilt. file.

For example, if you have app/assets/js/app.esbuild.js, running the build command will create app/assets/js/app.esbuilt.js alongside it.

TypeScript and JSX entries work too — app.esbuild.ts, app.esbuild.tsx, and app.esbuild.jsx all compile to a .esbuilt.js output. JSX uses the automatic runtime, so you don't need to import React in every file.

// app/assets/js/app.esbuild.js
import { someFunction } from "./utils.js";

someFunction();

After building, you can reference the bundled file in your templates:

<script src="{{ asset('js/app.esbuilt.js') }}"></script>

The bundler automatically:

  • Bundles all imports into a single file
  • Generates source maps
  • Minifies the output (in production builds)
  • Targets the browser platform

CLI commands

Build

Build all .esbuild. files in your asset directories:

plain esbuild build

This command finds all files containing .esbuild. in your asset directories and bundles them using esbuild. The output files are minified by default.

Dev

Watch for changes and rebuild automatically:

plain esbuild dev

The dev command performs an initial build (without minification) and then watches for file changes. Each build records which files were bundled into each entry, so when a JS/TS source file changes, only the entries that actually import it are rebuilt — you can split your code into modules and they'll be picked up. If you delete an entry file, the corresponding .esbuilt. output file is also removed.

FAQs

What files should I gitignore?

Add this pattern to your .gitignore to exclude the generated bundle files:

**/assets/**/*.esbuilt.*

Do I need to install esbuild separately?

Yes, esbuild must be available via npx. Make sure you have a package.json in your project with esbuild as a dependency:

npm install --save-dev esbuild

How do I use this with plain assets compile?

The esbuild commands integrate with the asset compile pipeline through entrypoints. When you run plain assets compile, it will automatically run esbuild first if you have configured it in your build pipeline.

Can I customize esbuild options?

The esbuild function accepts a minify option. For more advanced customization, you can call the function directly in your own build scripts.

Installation

Install the plain.esbuild package from PyPI:

uv add plain.esbuild

Make sure you have esbuild available in your project:

npm install --save-dev esbuild

Create a JavaScript file with .esbuild. in the name:

// app/assets/js/app.esbuild.js
console.log("Hello from esbuild!");

Run the build command:

plain esbuild build

Add the generated files to your .gitignore:

**/assets/**/*.esbuilt.*

Metadata

Release files for plain.esbuild 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plain.esbuild 0.11.0
File Size Uploaded
plain_esbuild-0.11.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plain.esbuild 0.11.0
File Interpreter ABI Platform
plain_esbuild-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / plain_esbuild-0.11.0.tar.gz

Download URL plain_esbuild-0.11.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
439030c7ead1b50be5b7a7eeca29f76c0cd90a25e9cc6e0df2f242c91b3303ff
BLAKE2b-256 checksum
How to use checksums
b72673c78d401d7b6dca2b641554318f04c2687bef68c9ecc87e80a73c0c5181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / plain_esbuild-0.11.0-py3-none-any.whl

Download URL plain_esbuild-0.11.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
159bfc3169050162605e6f75e2e031301ae688a14a988c2a1c6902e8f4d747d9
BLAKE2b-256 checksum
How to use checksums
f9afb80056661522832da8aea3aeb5c0f8c4777cbac25cc28a509cb585e33cd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page