-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(adapter-node): precompress (gzip & brotli) assets #1693
feat(adapter-node): precompress (gzip & brotli) assets #1693
Conversation
🦋 Changeset detectedLatest commit: 37dc6d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c3b04cd
to
ea6372d
Compare
have you seen this PR that was recently merged? #1672 The discussion mentions how to add precompression with a custom script or other plugins. If automatic pre-compression was added to sveltekit i think it should be configurable and default to disabled |
Yes I saw that PR and it is the reason for this PR. I currently use an additional script after the build but I think it would be nice to have it included in the build because precompressed assets are supported during runtime (sirv) but not within the build step. I agree that it should be configurable and will adjust the PR accordingly. |
ea6372d
to
f873cfd
Compare
There are a lot more options/settings that could be considered when pre-compressing:
This is of course too much to add to adapter node and a simple boolean with sensible defaults is ok imho. What those defaults are and if it should live somewhere else i'm not sure. other compression plugins: |
I agree. They are a lot of possible options. I believe a sensible default like proposed in this PR would make sense as it covers the most common case – text file compression using gzip and brotli. As it is opt-in users could implement their own advanced solution or enable the 80% solution provided by the plugin. Do you think this PR has a chance of merging? If that is the case should I add the following?
|
9b875f4
to
f2d074c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, i dont think we need to implement a p-map
-like throttler
f2d074c
to
f4104d7
Compare
Brotli and GZ don't seem to be enabled for |
I'll take a look. |
f4104d7
to
fb3ed4d
Compare
Done. |
Just an FYI – it's much harder to follow/track PR updates when you force-push |
fb3ed4d
to
bbeaa86
Compare
Sorry. Don't know what I was thinking. You are totally right. PS Did the last commit just before I read your comment. |
@sastan it looks like this PR will need to be rebased |
sirv supports using precompressed assets but they are not generated during the build. This PR precompresses html, js, json, css, svg, and xml assets using gzip and brotli during the adapt phase which allows sirv to use these.
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
This reverts commit 58b1820.
e1112a9
to
37dc6d9
Compare
@benmccann Rebased. |
sirv supports using precompressed assets but they are not generated during the build. This PR allows to precompresses html, js, json, css, svg, and xml assets and prerenderd pages using gzip and brotli during the adapt phase which allows sirv to use these.
It introduces a new option
precompress?: boolean
to enable to precompression. It defaults tofalse
- i.e. you must opt-in to generate precompressed assets.This PR adds support for precompressed pre-rendered pages as well.
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts