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

Enable compression on dev server responses #419

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

stramel
Copy link
Contributor

@stramel stramel commented Jun 3, 2020

Fixes #416
Enables compression for files sent in dev server.

I went ahead and added br and deflate quickly since they were only a couple extra if statements. Let me know if you would like those removed.

Without compression:
image

With gzip compression:
image

@FredKSchott We shouldn't be applying compression to binary files, I'm not currently accounting for that. Should I add a lib like compressible to determine it? (Update: Added as a separate commit which we can remove if you want)

Future enhancements, we could check the file size and apply a threshold before compressing since sometimes smaller files can actually get larger and just cause an additional load to the server

@stramel stramel requested a review from FredKSchott June 3, 2020 17:17
@stramel stramel self-assigned this Jun 3, 2020
src/commands/dev.ts Outdated Show resolved Hide resolved
src/commands/dev.ts Show resolved Hide resolved
package.json Show resolved Hide resolved
Copy link
Owner

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Feel free to merge when you're ready

@stramel stramel force-pushed the ms/enable-compression branch from 43a3962 to 40c50b6 Compare June 3, 2020 20:13
@stramel stramel changed the title Enable compression on responses Enable compression on dev server responses Jun 3, 2020
@stramel stramel merged commit e121749 into FredKSchott:master Jun 3, 2020
@stramel stramel deleted the ms/enable-compression branch June 3, 2020 20:18
@matthoffner
Copy link
Contributor

Thanks @stramel

@stramel stramel mentioned this pull request Jun 4, 2020
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

Successfully merging this pull request may close these issues.

Enable gzip compression in dev mode
3 participants