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

@embroider/macros uses previously cached macro condition #906

Closed
brendenpalmer opened this issue Jul 26, 2021 · 1 comment · Fixed by #913
Closed

@embroider/macros uses previously cached macro condition #906

brendenpalmer opened this issue Jul 26, 2021 · 1 comment · Fixed by #913
Assignees

Comments

@brendenpalmer
Copy link

We're seeing issues where a previously cached macro condition is being used as part of the build. For example, ember-engines uses @embroider/macros to have differing logic depending on ember-source version. It's possible for (seemingly) a previously cached macro condition to be used for an incompatible ember-source version. The macro condition that's evaluated as part of the build can be incorrect, and you can get into a state where the macro condition is evaluated correctly without broccoli-persistent-filter's caching enabled (CI=true); however, with broccoli-persistent-filter's caching enabled (regular builds without CI=true) the macro condition is incorrect.

For a simple reproduction I've created a sample repo in OSS: https://github.com/brendenpalmer/embroider-macros-caching-repro.

Steps to reproduce:

  1. Clone repo, yarn install
  2. Run ember b
  3. Open dist/assets/vendor.js; the evaluated macro (specifically the one used in link-to-external) from ember-engines is correct
  4. Run yarn add [email protected]
  5. Run ember b
  6. Open dist/assets/vendor.js; the evaluated macro (specifically the one used in link-to-external) from ember-engines is incorrect
  7. Run CI=true ember b
  8. Open dist/assets/vendor.js; notice that the evaluated macro (specifically the one used in link-to-external) is now different
@thoov
Copy link
Collaborator

thoov commented Jul 28, 2021

I was able to reproduce. One minor change to the above steps to reproduce:

4. Run yarn add [email protected]
4. Run yarn add [email protected]

Some of the dependencySatisfies checks in engines are checking for this version so this version guarantees that all checks will toggle. I will look into this.

thoov added a commit to thoov/embroider that referenced this issue Jul 29, 2021
dependencySatisfies can become invalid if babel caches the macros
plugin + the dependency that is being checked for changes its package
version. This adds a cache busting plugin that tracks a hash of the
contents of the apps lock file so any changes to dependencies will
bust the cache.

Fixes: embroider-build#906
thoov added a commit to thoov/embroider that referenced this issue Aug 4, 2021
dependencySatisfies can become invalid if babel caches the macros
plugin + the dependency that is being checked for changes its package
version. This adds a cache busting plugin that tracks a hash of the
contents of the apps lock file so any changes to dependencies will
bust the cache.

Fixes: embroider-build#906
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

Successfully merging a pull request may close this issue.

2 participants