Skip to content

Deterministic version.name #14176

Description

@teemingc

Describe the bug

See #14166 for context.

Our documentation requires a deterministic value for the version.name config setting but does not warn the user if they have used something indeterministic. This can be very difficult to debug as the app version hash can change throughout the build if we load the svelte config more than once, causing the scripts to not match to the correct payload name.

Furthermore, our default value for the setting is based on the build time. However, nothing could have changed and the version name will still be different when re-running the build. This is indeterministic too. Not sure if this is what currently affects the asset hashes to change too often too, will have to dig into this, but would be great if this solves that problem as well.

Some ideas from Rich:

I think it might be worth us investing some time to think about what it would mean to have a deterministic version automatically. For example: I haven't thought this all the way through but could we generate the version dynamically by hashing the inputs to Vite? Maybe we need to account for externalised server-side dependencies, in which case perhaps we need to account for a lockfile/package.json in addition. Or maybe even if the code hasn't changed, we need to account for any data that changed in prerendered content, in which case perhaps we use a placeholder value at first, compute the version after prerendering, and then replace the placeholder in any outputs in which it appeared?

Edit: possibly related #12260

Reproduction

gageracer/sudokusu#6 (comment)

Logs

System Info

-

Severity

serious, but I can work around it

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionNot sure if we want to do this yet, also design work needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions