From c32f52a6246a0f929238f7d47bfc870899729fb4 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 30 Aug 2023 15:10:28 +0100 Subject: [PATCH] chore: add warnings to console for deprecated options (#8283) --- .changeset/proud-trains-wonder.md | 5 +++++ packages/astro/src/core/build/index.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/proud-trains-wonder.md diff --git a/.changeset/proud-trains-wonder.md b/.changeset/proud-trains-wonder.md new file mode 100644 index 000000000..0e437cfad --- /dev/null +++ b/.changeset/proud-trains-wonder.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Add useful warning when deprecated options are still used. diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 013d83a5b..5280e69e3 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -242,6 +242,10 @@ class AstroBuilder { 'The option `build.split` won\'t take effect, because `output` is not `"server"` or `"hybrid"`.' ); } + this.logger.warn( + 'configuration', + 'The option `build.split` is deprecated. Use the adapter options.' + ); } if (config.build.excludeMiddleware === true) { if (config.output === 'static') { @@ -250,14 +254,10 @@ class AstroBuilder { 'The option `build.excludeMiddleware` won\'t take effect, because `output` is not `"server"` or `"hybrid"`.' ); } - } - - if (config.build.split === true) { - if (config.output !== 'server') { - throw new Error( - 'The option `build.split` can only be used when `output` is set to `"server"`.' - ); - } + this.logger.warn( + 'configuration', + 'The option `build.excludeMiddleware` is deprecated. Use the adapter options.' + ); } }