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(core): unregister in-process ts transpilers when projectGraph is created #19187

Conversation

Cammisuli
Copy link
Member

@Cammisuli Cammisuli commented Sep 15, 2023

Current Behavior

When running CI=true we register ts transpilers in the main nx process. Usually this registration happens in the daemon, and has no effect on other processes that get spawned from the main nx process. But when registered in the main process, all child processes get the same registered transpiler.

This causes issues with NX_BATCH_MODE=true with jest for Nx Plugin tests because jest tried to load jest configuration files (which are in .ts), and when reading these files swc will transpile these to a format that is not supported in jest.

Expected Behavior

When we're done reading the workspace files, unregister transpilers so that child processes do not have their require functions patched.

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Sep 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 22, 2023 3:11am

@Cammisuli Cammisuli force-pushed the feature/nxc-75-jest-tests-fail-when-daemon-is-off-and-swc-nodecore-is-used branch from 78047b3 to 6a8193a Compare September 15, 2023 13:20
@@ -84,6 +85,8 @@ export async function retrieveWorkspaceFiles(
'get-workspace-files:end'
);

unregisterPluginTSTranspiler();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the transpiler not just get re-registered when creating the dependencies? It seems like this should be done at the end of createProjectGraphAsync or similar as well.

@Cammisuli Cammisuli force-pushed the feature/nxc-75-jest-tests-fail-when-daemon-is-off-and-swc-nodecore-is-used branch from 6a8193a to 08f5621 Compare September 15, 2023 16:53
@Cammisuli Cammisuli changed the title fix(core): unregister in-process ts transpilers when workspace files are retrieved fix(core): unregister in-process ts transpilers when projectGraph is created Sep 15, 2023
@Cammisuli Cammisuli force-pushed the feature/nxc-75-jest-tests-fail-when-daemon-is-off-and-swc-nodecore-is-used branch from 08f5621 to ab1e2f7 Compare September 19, 2023 16:02
@Cammisuli Cammisuli force-pushed the feature/nxc-75-jest-tests-fail-when-daemon-is-off-and-swc-nodecore-is-used branch from ab1e2f7 to 7289c26 Compare September 19, 2023 17:16
@Cammisuli Cammisuli force-pushed the feature/nxc-75-jest-tests-fail-when-daemon-is-off-and-swc-nodecore-is-used branch from 7289c26 to df0ae47 Compare September 20, 2023 21:24
@FrozenPandaz FrozenPandaz merged commit ca85d26 into nrwl:master Sep 22, 2023
4 of 6 checks passed
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants