bug: esbuild config cannot be overridden for many scenarios
- Dominant language
- JavaScript
- Stars
- 105
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used [patch-package](https://github.com/ds300/patch-package) to patch `aegir@42.2.2` for the project I'm working on.
Here is the diff that solved my problem:
```diff
diff --git a/node_modules/aegir/src/build/index.js b/node_modules/aegir/src/build/index.js
index 54537df..6df4c61 100644
--- a/node_modules/aegir/src/build/index.js
+++ b/node_modules/aegir/src/build/index.js
@@ -36,26 +36,31 @@ const build = async (argv) => {
entryPoint = fromRoot('dist', 'src', 'index.js')
}
- const result = await esbuild.build(defaults(
+ const config = defaults(
{
entryPoints: [entryPoint],
bundle: true,
- format: 'iife',
+ format: argv.fileConfig.build.config.format ?? 'iife',
conditions: ['production'],
sourcemap: argv.bundlesize,
minify: true,
globalName,
- banner: { js: umdPre },
- footer: { js: umdPost },
+ banner: argv.fileConfig.build.config.banner ?? { js: umdPre },
+ footer: argv.fileConfig.build.config.footer ?? { js: umdPost },
metafile: argv.bundlesize,
- outfile,
+ outfile: argv.fileConfig.build.config.outfile == null ? undefined : outfile,
define: {
global: 'globalThis',
'process.env.NODE_ENV': '"production"'
}
},
argv.fileConfig.build.config
- ))
+ )
+ if (config.outdir) {
+ delete config.outfile
+ }
+
+ const result = await esbuild.build(config)
if (result.metafile) {
fs.writeJSONSync(path.join(paths.dist, 'stats.json'), result.metafile)
```
This issue body was [partially generated by patch-package](https://github.com/ds300/patch-package/issues/296).
---
the above was generated by patch-package. Some things I was trying to do that caused me to create this:
1. set outputdir instead of outfile
2. change format
3. remove banner and footer that were not needed for the format I wanted.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.