From 18cb3c60e6e83a7d1aad120f8552d8805a241779 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 21 Oct 2024 22:21:55 +0200 Subject: [PATCH] Upgrade: Allow `corePlugins` in JS config files (#14742) This PR enables JS configuration files with `corePlugins` themes to be migrated. If such option is found in your config, we will warn the user and omit the option from the resulting CSS file as there is no v4 alternative. --------- Co-authored-by: Adam Wathan --- CHANGELOG.md | 1 + packages/@tailwindcss-upgrade/src/migrate-js-config.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f1317f2eb3..8c5e3f489859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - _Upgrade (experimental)_: Migrate `plugins` with options to CSS ([#14700](https://github.com/tailwindlabs/tailwindcss/pull/14700)) +- _Upgrade (experimental)_: Allow JS configuration files with `corePlugins` options to be migrated to CSS ([#14742](https://github.com/tailwindlabs/tailwindcss/pull/14742)) ### Fixed diff --git a/packages/@tailwindcss-upgrade/src/migrate-js-config.ts b/packages/@tailwindcss-upgrade/src/migrate-js-config.ts index 3c7818902953..20f7fdd7f53c 100644 --- a/packages/@tailwindcss-upgrade/src/migrate-js-config.ts +++ b/packages/@tailwindcss-upgrade/src/migrate-js-config.ts @@ -63,6 +63,12 @@ export async function migrateJsConfig( if (themeConfig) cssConfigs.push(themeConfig) } + if ('corePlugins' in unresolvedConfig) { + info( + `The \`corePlugins\` option is no longer supported as of Tailwind CSS v4.0, so it's been removed from your configuration.`, + ) + } + let simplePlugins = findStaticPlugins(source) if (simplePlugins !== null) { for (let [path, options] of simplePlugins) { @@ -214,6 +220,7 @@ function canMigrateConfig(unresolvedConfig: Config, source: string): boolean { 'plugins', 'presets', 'prefix', // Prefix is handled in the dedicated prefix migrator + 'corePlugins', ] if (Object.keys(unresolvedConfig).some((key) => !knownProperties.includes(key))) {