-
Notifications
You must be signed in to change notification settings - Fork 9
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
chore!: dist files optimizations (sw asset name changes) #97
Conversation
- dont gzip html files
webpack.config.js
Outdated
numiterations: 15, | ||
minRatio: 0.8 | ||
}, | ||
deleteOriginalAssets: true |
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.
deleteOriginalAssets
was in the wrong location (inside compressionOptions
) previously.
ok.. for testing redirects locally, taken from https://github.com/ipfs/kubo/blob/e22f47ae4b4d83cf5e3f1c901c10905ebd69d492/test/sharness/t0109-gateway-web-_redirects.sh#L3
we can do the following with a locally running kubo node:
and it will fail if the redirect doesn't match. |
Before merging from main (with all the updates from #89 and others) After merging from main: |
without node-polyfills-plugin (78a564f) |
i've got it down a bit, and normalized some of the output chunk names in |
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.
.gz
produced by CompressionPlugin
are not used, we have gzip
support on inbrowser.link
without them. see details below
let's focus this PR to be about minimizing browser bundle, infra stuff is out of scope
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.
self review
@@ -1,7 +1,7 @@ | |||
import { log } from './lib/logger.ts' | |||
|
|||
export async function registerServiceWorker (): Promise<ServiceWorkerRegistration> { | |||
const swRegistration = await navigator.serviceWorker.register(new URL('sw.ts', import.meta.url)) | |||
const swRegistration = await navigator.serviceWorker.register(new URL(/* webpackChunkName: "sw" */'sw.ts', import.meta.url)) |
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.
name is prefixed in webpack config
@@ -103,6 +105,21 @@ self.addEventListener('fetch', (event) => { | |||
* Functions | |||
****************************************************** | |||
*/ | |||
async function getVerifiedFetch (): Promise<VerifiedFetch> { |
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.
moved in here because nothing else is using it
webpack.config.js
Outdated
chunks: 'async', | ||
minSize: 20000, | ||
minRemainingSize: 0, | ||
minChunks: 1, | ||
maxAsyncRequests: 30, | ||
maxInitialRequests: 30, | ||
enforceSizeThreshold: 1024, |
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.
most of these are defaults
output: { | ||
path: paths.build, | ||
publicPath: '/', | ||
filename: 'ipfs-sw-[name].js' |
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.
dev and prod build produce the same assets now
Title
Gzip compression for prod builds only.
Description
related to #96 & #93
On
main
(without #89 and #94)Development builds are 20M
Prod builds are 3.5M
Notes & open questions
Notes
FYSI, my nginx config required the following changes:
gzip_static on;
to serve pre-compressed files--with-http_gzip_static_module
to enable serving pre-compressed filesbrew tap denji/nginx
brew install nginx-full --with-http_gzip_static_module
/*.js /:splat.js.gz 301
/:splat.css /:splat.css.gz 301
Questions
Change checklist