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) {