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

fix: reintroduce watch and direct import of config files #2634

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

AviVahl
Copy link
Contributor

@AviVahl AviVahl commented Jan 20, 2025

engine-cli used to have 3 config modes:

  1. require - was actually doing a direct import() to the config (was a require() call before the move to esm)
  2. watch - bundles config files into cjs bundles. this was (and still is) broken when the config module, or any of the files it imports use esm-specific syntax (e.g import.meta).
  3. fresh - this used import() via a freshly created worker_thread. it allowed getting the "current" value of a config file (in dev time), meaning you don't have to watch. it got broken when we moved to esm.

#2629 removed the first two and fixed the third. this caused a speed regression downstream, as tests imported configs over and over in a non-cached manner.

with this PR, we now have 3 modes again:

  1. import - same functionality as before, but a non-confusing name
  2. watch - same functionality as before. still broken when using native esm syntax
  3. fresh - got fixed so it actually works again. not used unless cli flag is passed

import is now the default unless cli is in watch mode (where watch gets be the default)

`engine-cli` used to have 3 config modes:
1. require - was actually doing a direct `import()` to the config (was a `require()` call before the move to esm)
2. watch - bundles config files into cjs bundles. this was (and still is) broken when the config module, or any of the files it imports use esm-specific syntax (e.g import.meta).
3. fresh - this used `import()` via a freshly created worker_thread. it allowed getting the "current" value of a config file (in dev time), meaning you don't have to watch. it got broken when we moved to esm.

#2629 removed the first two and fixed the third. this caused a speed regression downstream, as tests imported configs over and over in a non-cached manner.

with this PR, we now have 3 modes again:
1. "import" - same functionality as before, but a non-confusing name
2. "watch" - same functionality as before. still broken when using native esm syntax
3. fresh - got fixed so it actually works again. not used unless cli flag is passed

"import" is now the default unless cli is in watch mode (where "watch" gets be the default)
@AviVahl AviVahl merged commit 8521f8d into master Jan 20, 2025
6 checks passed
@AviVahl AviVahl deleted the avi/fix-config-performance branch January 20, 2025 18:50
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 this pull request may close these issues.

1 participant