Skip to content

Commit

Permalink
fix(core): prettier 3 shouldn't cause errors due to esm + compile cac…
Browse files Browse the repository at this point in the history
…he (#19042)

(cherry picked from commit f1be92e)
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Sep 7, 2023
1 parent 18acd9a commit ac2bea7
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 ac2bea7

Please sign in to comment.