Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aelbore opened this issue May 24, 2020 · 4 comments
Closed

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

aelbore opened this issue May 24, 2020 · 4 comments

Comments

@aelbore
Copy link

aelbore commented May 24, 2020

  • 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

@evanw
Copy link
Owner

evanw commented May 25, 2020

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.

@eigilsagafos
Copy link

@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.

@aelbore
Copy link
Author

aelbore commented Jul 5, 2020

@evanw this is amazing i will try once theres new version 👍🥳

@evanw
Copy link
Owner

evanw commented Jul 6, 2020

Version 0.5.22 with this change has now been published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants