The identifiers for options.define should be replaced before injecting modules in options.inject
Another way to put this: define identifiers should have higher priority than exports in inject
This would prevent many injections from running, for example replacing occurrences of process.env.VAR with define could skip the injection of a ./process.js module
Currently the injections are run first, which also means that the identifiers in define are never used if they are properties of an object exported from a module in inject
Reproduction: https://github.com/remorses/esbuild-inject-overrides-defines
The identifiers for
options.defineshould be replaced before injecting modules inoptions.injectAnother way to put this:
defineidentifiers should have higher priority than exports ininjectThis would prevent many injections from running, for example replacing occurrences of
process.env.VARwith define could skip the injection of a./process.jsmoduleCurrently the injections are run first, which also means that the identifiers in
defineare never used if they are properties of an object exported from a module ininjectReproduction: https://github.com/remorses/esbuild-inject-overrides-defines