Core: Enable gzip compression on the development server#14459
Merged
shilman merged 2 commits intostorybookjs:nextfrom Apr 8, 2021
Merged
Core: Enable gzip compression on the development server#14459shilman merged 2 commits intostorybookjs:nextfrom
shilman merged 2 commits intostorybookjs:nextfrom
Conversation
shilman
requested changes
Apr 3, 2021
Member
shilman
left a comment
There was a problem hiding this comment.
Hi @kaelig, this looks great! However, it looks like there are some types missing which is causing the build to break:
@storybook/core-server: src/dev-server.ts(2,25): error TS7016: Could not find a declaration file for module 'compression'. '/tmp/storybook/node_modules/compression/index.js' implicitly has an 'any' type.
@storybook/core-server: Try `npm install @types/compression` if it exists or add a new declaration (.d.ts) file containing `declare module 'compression';
Looks like it's on DefinitelyTypeed:
MMBP15:storybook shilman$ npm info @types/compression
@types/compression@1.7.0 | MIT | deps: 1 | versions: 20
TypeScript definitions for compression
Contributor
Author
|
Thanks! My local tests consisted of modifying the compiled version in I updated the PR 🤞 |
Member
|
FYI, we're in a merge freeze while the latest release is stabilizing. We'll resume merging PRs and publishing daily-ish alphas in a week or two. Thanks for your patience! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #14280
What I did
This PR enables compression on assets served by the dev server. The compression level is low, which yields good compression results without slowing down the feedback loop between saving a file and changes appearing in the browser.
This is useful when a Storybook has large bundles.
How to test
Make sure HMR works as expected. It should be okay, but in older versions of the compression package, it could sometimes be an issue.
Also ensure loading and reloading performance is within acceptable parameters.