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): prettier 3 shouldn't cause errors due to esm + compile cache #19042

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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