Skip to content

Add assets middleware #10795

@mjackson

Description

@mjackson

The assets middleware takes a directory of files that are considered public assets for the frontend, uses them all as entry points in an esbuild context. It runs the build and serves the results when a request comes in for one of the entry points.

When env.SERVER_MODE === 'development', the assets middleware runs esbuild in watch mode to automatically rebuild as the underlying assets change.

Note: this middleware should be stable enough to use in production in environments where the application source code is available on disk.

Because of the dependency on esbuild, this middleware should probably not be part of the fetch-router package.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions