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

Randomized import name leads to non-deterministic builds #92

Open
davidtaylorhq opened this issue Jan 16, 2025 · 0 comments
Open

Randomized import name leads to non-deterministic builds #92

davidtaylorhq opened this issue Jan 16, 2025 · 0 comments

Comments

@davidtaylorhq
Copy link

As part of its transformation, content-tag introduces a new es6 import like

import { template as template_fd9b2463e5f141cfb5666b64daa1f11a } from "@ember/template-compiler";

The local name is a randomised UUID which changes every time content-tag is called:

content-tag/src/lib.rs

Lines 123 to 127 in 44d8b16

let id = private_ident!(format!(
"{}_{}",
target_specifier,
Uuid::new_v4().to_string().replace("-", "")
));

This randomisation makes the build output different each time, which means that bundled chunks get given different hashes, and end-users get no cache-reuse between deploys of our application.

It would be great if the import name could be made deterministic. Either by picking a pseudo-random identifier which is extremely unlikely to be used in user-space (like decorator-transforms). Or by adding logic to check for existing identifiers in the file, and pick something which does not clash.

davidtaylorhq added a commit to discourse/discourse that referenced this issue Jan 16, 2025
This improves the developer experience, and also happens to workaround embroider-build/content-tag#92 in our production builds.
davidtaylorhq added a commit to discourse/discourse that referenced this issue Jan 16, 2025
This improves the developer experience, and also happens to workaround
embroider-build/content-tag#92 in our
production builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant