Skip to content

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

@peterpeterparker

Description

@peterpeterparker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions