evanw / evanw/esbuild

Per-file banner

Open
#2,840 0 comments 10 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

It would be very useful if plugins were able to provide a set of custom defines or injects (basically a banner) on a per file basis without overriding the whole `onLoad` process (which would decrease perfs by preventing Esbuild from reading the files itself, and wouldn't work well with source maps).

It's kinda what you suggested in https://github.com/evanw/esbuild/issues/859 for `__dirname`:

> I think my preferred solution for this is going to be to use the --define feature in addition to adding the ability for plugins to add additional per-file configuration of input flags such as --define. This seems more general and appropriately minimal (not really adding more features, but just combining two existing features). This is not possible at the moment because plugins do not yet have the ability to configure these input flags per-file.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the requested per-file custom defines or injects alongside the referenced issue #859. Examine how plugins currently use onLoad, how esbuild reads files and handles source maps, and how the existing --define input flag is represented. Done means plugins can configure these values per file without taking over file loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.