Skip to content

Commit

Permalink
fix(core): prettier 3 shouldn't cause errors due to esm + compile cache
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Sep 6, 2023
1 parent 2bc7031 commit 2786a8f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/nx/bin/nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ function main() {
process.env.NX_DAEMON = 'false';
require('nx/src/command-line/nx-commands').commandsObject.argv;
} else {
if (workspace && workspace.type === 'nx') {
// v8-compile-cache doesn't support ESM. Attempting to import ESM
// with it enabled results in an error that reads "Invalid host options".
//
// Angular CLI, and prettier both use ESM so we need to disable it in these cases.
if (
workspace &&
workspace.type === 'nx' &&
!['format', 'format:check', 'format:write', 'g', 'generate'].some(
(cmd) => process.argv[3] === cmd
)
) {
require('v8-compile-cache');
}
// polyfill rxjs observable to avoid issues with multiple version of Observable installed in node_modules
Expand Down

0 comments on commit 2786a8f

Please sign in to comment.