From 884eed08f4f2300d41691107bbd5da66d9e3a3cc Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Fri, 15 Sep 2023 12:58:14 -0400 Subject: [PATCH] warn that `future.v2_dev` should be moved to `dev` in v2 --- .changeset/odd-bananas-teach.md | 7 +++++++ packages/remix-dev/config.ts | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .changeset/odd-bananas-teach.md diff --git a/.changeset/odd-bananas-teach.md b/.changeset/odd-bananas-teach.md new file mode 100644 index 00000000000..509d3364349 --- /dev/null +++ b/.changeset/odd-bananas-teach.md @@ -0,0 +1,7 @@ +--- +"@remix-run/dev": patch +--- + +Warn if `future.v2_dev` is set + +Prompt user to delete it if its set to `true` or move it to `dev` if its an object. diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 00d43bd88f5..9d3c0503a07 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -568,18 +568,29 @@ export async function readConfig( "unstable_postcss", "unstable_tailwind", "unstable_vanillaExtract", - "v2_dev", "v2_errorBoundary", "v2_headers", "v2_meta", "v2_normalizeFormMethod", "v2_routeConvention", - ] as const; + ]; + + if ("v2_dev" in userFlags) { + if (userFlags.v2_dev === true) { + deprecatedFlags.push("v2_dev"); + } else { + logger.warn("The `v2_dev` future flag is obsolete.", { + details: [ + "Move your dev options from `future.v2_dev` to `dev` within your `remix.config.js` file", + ], + }); + } + } let obsoleteFlags = deprecatedFlags.filter((f) => f in userFlags); if (obsoleteFlags.length > 0) { logger.warn( - `⚠️ REMIX FUTURE CHANGE: the following Remix future flags are now obsolete ` + + `The following Remix future flags are now obsolete ` + `and can be removed from your remix.config.js file:\n` + obsoleteFlags.map((f) => `- ${f}\n`).join("") );