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

Integrate esbuild with Arc deploy #30

Closed
gitblit opened this issue Mar 19, 2022 · 6 comments
Closed

Integrate esbuild with Arc deploy #30

gitblit opened this issue Mar 19, 2022 · 6 comments
Assignees

Comments

@gitblit
Copy link

gitblit commented Mar 19, 2022

This stack works very nicely and is a huge step forward. I do note that the deployed lambda is pretty large (7MB zip) and it's because it contains the entire node_modules directory (unpacked 29MB).

It would be really nice for server.js to be in TypeScript and to integrate esbuild into the Arc deploy process, not just the app compilation step, so only the needed code is deployed.

@gitblit
Copy link
Author

gitblit commented Mar 24, 2022

Amazing! I can't wait to see the improvement on the lambda deployment.

@kentcdodds did you mean to commit server.js ? Seems like maybe that should be deleted and gitignored since you wrote server.ts?

@kentcdodds
Copy link
Member

kentcdodds commented Mar 24, 2022

Good catch! Pushed that removal :)

@gitblit
Copy link
Author

gitblit commented Mar 25, 2022

@kentcdodds I have good news & bad news.

  • 🎉 server.ts looks great!
  • 😢 the deployed lambda size went the wrong direction. Now it's bundling 108MB instead of 29MB of dependencies.

Screenshot from 2022-03-24 20-47-06

@kentcdodds
Copy link
Member

@tbeseda @jacob-ebey do you know what we might be doing wrong here?

@gitblit
Copy link
Author

gitblit commented Mar 27, 2022

I played around with this a little and got somewhat further, but it's not much further than I got in Dec/Jan when I was first exploring this.

  • I started with the code before the commit associated with this issue (so pre-ts-node changes)
  • I cheated and renamed server.js to server.ts but otherwise left it as-is (I'm not overly experienced in the JS/TS space, this was a shortcut just to produce something)
  • I added the arc plugin for typescript as documented here

This results in:

  • 🎉 a 2MB deployed lambda with only what is needed (the goal)
  • 🐛 a break in local/sandbox workflow since server.ts is not automatically recompiled when the Remix app is recompiled. (not the goal). Perhaps this is what ts-node brings to the table?

I think that is the fundamental issue - how to blend the two TypeScript build phases - the one for Remix & the one for Arc sandbox.

@recipher
Copy link

Is there any progress here?

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

4 participants