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

[Bug] nitro.compressPublicAssets = true breaks SSR on / route #1360

Open
1 of 2 tasks
renatoaraujoc opened this issue Sep 22, 2024 · 0 comments
Open
1 of 2 tasks

[Bug] nitro.compressPublicAssets = true breaks SSR on / route #1360

renatoaraujoc opened this issue Sep 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@renatoaraujoc
Copy link

Please provide the environment you discovered this bug in.

There's no need for an environement.

Which area/package is the issue in?

vite-plugin-nitro

Description

When opt-in for compressPublicAssets, the following analog() config fails to render / route as SSR and just spits out the non-rendered version of it, example:

analog({
    ssr: true,
    prerender: {
        routes: ['/']
    },
    nitro: {
        routeRules: {
            '/': {
                prerender: false
            }
        },
        compressPublicAssets: true, // or { brotli: true, gzip: true }
    }
})

The above will create 1/2 files (depending on the config):

./dist/app/analog/public/index.html.gz
./dist/app/analog/public/index.html.br

Screenshot 2024-09-22 at 06 49 08

The files above will be reconized by nitro server as static assets and will not go thru the SSR rendering, as seen here:

Screenshot 2024-09-22 at 06 51 44

Screenshot 2024-09-22 at 06 52 26

Turning off compressPublicAssets solves the issue and / is renderable again, but we lose the compressed stuff.

Solution: strip out index.html from being .gz'd and br'd in the public folder so nitro server doesn't include it on the assets array.

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@renatoaraujoc renatoaraujoc added the bug Something isn't working label Sep 22, 2024
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

No branches or pull requests

1 participant