-
Notifications
You must be signed in to change notification settings - Fork 23
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
Prevent configuration file "loading loop" when transpiling TS. #202
Conversation
…ng TypeScript configs.
if (equal(project.config.rawConfig, config.rawConfig)) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this logic when I saw that there were too many file events happening, but didn't know why and assumed the reason was something outside the scope of this Extension.
Removing it here again, since sometimes we actually want a restart even if the config didn't really change.
You can download the latest build of the extension for this PR here: To install the extension, download the file, unzip it and install it in VS Code by selecting "Install from VSIX..." in the Extensions view. Alternatively, run code --install-extension vscode-apollo-0.0.0-build-1726589621.pr-202.commit-2dabc63.vsix --force from the command line. For older builds, please see the edit history of this comment. |
I've come to the conclusion that creating this file in another folder is not a good idea, since it would stop any imports from working... doing some changes. |
This was also present in the original
cosmiconfig
loader logic, which would compile aapollo.config.ts
to aapollo.config.mjs
and then import from that file.Problem with this is that that file creation (and deletion) would trigger the file event watcher, which then would trigger another config parse, leading to an infinite loop.
This didn't lead to particularly high system load, since it happened only every 2 seconds or so, with all the async layers involved, but it was definitely problematic.
We now create that file in a temporary directory outside the workspace, and we use
apollo.config.ts.mjs
, which is not a valid config file name and wouldn't lead to a loop even if picked up (e.g. if someone opens the system temp folder as a workspace).