How to stop build hashes from changing between environments?

I'm trying to build the app and upload its sourcemaps in 2 different CI steps, but for some reason the app build builds different filenames in both scenarios, even tho the git commit is the same. I even made sure that sourcemaps are built in both scenarios (cause apparently just toggling source maps changes the filename hashes, which is absurd), but still - the filename content hashes end up being different. What controls the contenthash and how do I ensure it stays the same across builds in different environments?
6 Replies
FabiansGeikinsSpeckle
The differences I have between the 2 CI step environments: - Project is stored at different locations in the filesystem - One has git, the other one might not - One runs in a docker image based on a slim node image, the other runs in a default CircleCI worker environment
Smef
Smef3mo ago
In general, Vite/Nuxt are going to generate different hashes in different builds. Nuxt 3.12 adds a new feature to limit this some which may help: https://github.com/nuxt/nuxt/pull/27258
GitHub
feat(nuxt,schema): add new appId option and improve chunk determi...
🔗 Linked issue 📚 Description This adds a new appId option and passes both appId and buildId via runtimeConfig. This means we don't have all chunk hashes changing on every build. (Caused by ent...
Smef
Smef3mo ago
You should probably do the build and the sourcemap upload in the same step. Running the same build process twice, in two different steps, doesn't sound like a good strategy in general.
TenerifeGuy
TenerifeGuy3mo ago
Hi! Is there an option to turn off the buildId in the nuxt.config.js ? This feature is breaking the entire CI/CD pipeline structure because of new hashes. I would prefer to set it to false and do not generate. Otherwise I will be stuck with verson 3.11.1 before the change. Do you want me to create a bug ticket for the config buildId to be optional?
Smef
Smef3mo ago
What's breaking? The default behavior is to generate different hashes every time, and that's been a behavior for a long time. The new feature lets you (optionally) set a static build ID so that the hashes do not change.
TenerifeGuy
TenerifeGuy2mo ago
@Smef well, here is the thing, that from version 3.12.0 the buildId is generating new hashes on every build. https://nuxt.com/docs/api/nuxt-config#buildid Which it wasn't doing that on the version before. I would like the buildId to stop being generated at every build. I would assume there is an option to add my custom string id (that would never change) or switch off the auto-generating buildId as in previous versions ending 3.11.2. Can you give me some guidance on this issue?
Want results from more Discord servers?
Add your server