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

Precompress+fallback => paths in index.html !== index.html.gz #8971

Closed
peterpeterparker opened this issue Feb 9, 2023 · 0 comments · Fixed by #8972
Closed

Precompress+fallback => paths in index.html !== index.html.gz #8971

peterpeterparker opened this issue Feb 9, 2023 · 0 comments · Fixed by #8972
Labels
bug Something isn't working
Milestone

Comments

@peterpeterparker
Copy link

Describe the bug

With the static adapter, using both precompress and fallback options generates differen build/index.html and build/index.html.gz.

i.e. if the Gzip file is decompressed, it's content does not exactly match the one of the plain html file. The relative paths in the Gzip file becomes prefixed with a dot.

This leads to an issue when Gzip content is provided over the wire and certification are calculated on the client side.

svelte.config:

kit: {
		adapter: adapter({
			fallback: 'index.html',
			precompress: true
		})
	}

generated index.html:

<link rel="modulepreload" href="/_app/immutable/start-6aae8ae3.js">
import { start } from "/_app/immutable/start-6aae8ae3.js";

generated unzipped index.html.gz:

<link rel="modulepreload" href="./_app/immutable/start-6aae8ae3.js">
import { start } from "./_app/immutable/start-6aae8ae3.js";

Reproduction

git clone https://github.com/peterpeterparker/my-app-gzip
cd my-app-gzip
npm i
npm run build
cd build
cp index.html.gz test.html.gz
gunzip test.html.gz
diff index.html test.html

Logs

No response

System Info

System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M2
    Memory: 97.70 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.0 - /usr/local/bin/node
    npm: 8.19.2 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 110.1.48.158
    Chrome: 109.0.5414.119
    Firefox: 109.0.1
    Safari: 16.2

Severity

annoyance

@Conduitry Conduitry transferred this issue from sveltejs/svelte Feb 9, 2023
@Rich-Harris Rich-Harris added the bug Something isn't working label Feb 9, 2023
@Rich-Harris Rich-Harris added this to the soon milestone Feb 9, 2023
Rich-Harris added a commit that referenced this issue Feb 9, 2023
* generate fallback page before compressing - fixes #8971

* remove logging

* lint

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants