You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rebuild?: (()=>Promise<BuildResult>)&{dispose(): void};// Only when "incremental" is true
Because of this, is necessary to adhere to some hacky solutions like this:
constbuildResult=awaitesbuildService.build({ ...esbuildConfig,incremental: true})buildResult.rebuild!()// non-null assertions defeats the purpose of using "strict: true" on tsconfig.json
require('esbuild').build({entryPoints: ['app.js'],bundle: true,outfile: 'out.js',incremental: true,}).then(result=>{// The "rebuild" method is present if "incremental" is true. It returns a// promise that resolves to the same kind of object that "build" returns.// You can call "rebuild" as many times as you like.result.rebuild().then(result2=>{// Call "dispose" when you're done to free up resources.result.rebuild.dispose()})})
The text was updated successfully, but these errors were encountered:
"The rebuild method is present if "incremental" is true
So that's why it's undefined. You might be able to do some TypeScript hackery to return a version of BuildResult with that one property added as non-optional, but I don't know if it's worth it since ! works. It's also not the only field that has conditional behaviour like this, see "outputFiles" on the same interface.
I'm not sure if this is intended, but the
.rebuild()
method from theBuildResult
interface, accordingly to the snippet below, can also be undefined:esbuild/lib/types.ts
Line 88 in 2fa473e
Because of this, is necessary to adhere to some hacky solutions like this:
or also:
or even this:
Is there anything that i'm missing? as shown in the example from
0.8.12
release https://github.com/evanw/esbuild/blob/master/CHANGELOG.md), there were no need for any checking to use the.rebuild()
methodThe text was updated successfully, but these errors were encountered: