esbuild JS API `entryPoints` now accepts array of objects
Closed this issue · 1 comments
wd-David commented
This error popped up after upgrading esbuild to ^0.17.1:
error TS2339: Property 'includes' does not exist on type 'string | { in: string; out: string; }'. Property 'includes' does not exist on type '{ in: string; out: string; }'.
It turns out that JS API updated since esbuild v0.17.1:
// The previous API didn't let you specify duplicate output paths
let result = await esbuild.build({
entryPoints: {
// This object literal contains a duplicate key, so one is ignored
'dist': 'foo.js',
'dist': 'bar.css',
},
})
// You can now specify duplicate output paths as an array of objects
let result = await esbuild.build({
entryPoints: [
{ in: 'foo.js', out: 'dist' },
{ in: 'bar.css', out: 'dist' },
],
})
Need to deal with the new API and consider new use cases.
wd-David commented
The source code uses the object type of entryPoints
.
It seems it's better to use an array of objects.