From c2d4ae1cbed622b2fadeb1fe8cc8bbed5f5adc8f Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Fri, 31 Mar 2023 15:18:37 +0200 Subject: [PATCH] fix(check): Dynamically import check command (#6717) --- .changeset/eight-stingrays-pull.md | 5 +++++ packages/astro/src/cli/index.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/eight-stingrays-pull.md diff --git a/.changeset/eight-stingrays-pull.md b/.changeset/eight-stingrays-pull.md new file mode 100644 index 000000000000..530fc833ccf9 --- /dev/null +++ b/.changeset/eight-stingrays-pull.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Dynamically import check command to improve startup speed and prevent Astro from crashing due to language-server stuff diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts index 3af54bc3ef60..23701ffdd8f5 100644 --- a/packages/astro/src/cli/index.ts +++ b/packages/astro/src/cli/index.ts @@ -18,7 +18,6 @@ import { enableVerboseLogging, nodeLogDestination } from '../core/logger/node.js import { formatConfigErrorMessage, formatErrorMessage, printHelp } from '../core/messages.js'; import * as event from '../events/index.js'; import { eventConfigError, eventError, telemetry } from '../events/index.js'; -import { check } from './check/index.js'; import { openInBrowser } from './open.js'; type Arguments = yargs.Arguments; @@ -228,6 +227,8 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { } case 'check': { + const { check } = await import('./check/index.js'); + // We create a server to start doing our operations const checkServer = await check(settings, { flags, logging }); if (checkServer) {