Esbuild: In memory output of Build API (adding write: boolean)

Created on 24 May 2020  路  4Comments  路  Source: evanw/esbuild

  • same as rollup theres write and generate function
  • write is to persist or write file to disk
  • generate is to output string or objects like code, map
  • this is useful if someone will create a plugin or any tools using esbuild

  • i did jest transformer (https://github.com/aelbore/esbuild-jest),
    im using rollup and rollup-plugin-esbuild then sync-rpc to wrap the async
    it would be good if build api would output result string

Most helpful comment

I would like to do this. The underlying transport mechanism for the API is already built this way, but the API currently only exposes the ability to transform a single file. So it's definitely possible to do this.

All 4 comments

I would like to do this. The underlying transport mechanism for the API is already built this way, but the API currently only exposes the ability to transform a single file. So it's definitely possible to do this.

@evanw Ref your question in #183 I did some quick benchmarks in my test suite.

babel: 10.18s cold, 4.46s cached
esbuild-jest: 5.48s cold, 2.79s cached
custom transformer with esbuild buildSync: 3.36s cold, 2.72s cached

I think this will improve with another 10-20ms if I can skip the tmp file. Anyway these are great improvements. The only thing currently keeping me from getting rid og babel in jest is getting jest.mock working on external libraries.

@evanw this is amazing i will try once theres new version 馃憤馃コ

Version 0.5.22 with this change has now been published.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lolychee picture lolychee  路  4Comments

aelbore picture aelbore  路  3Comments

a7ul picture a7ul  路  3Comments

frandiox picture frandiox  路  3Comments

mohsen1 picture mohsen1  路  3Comments