From 505f431728610ddd7261bb53fe14b75cc2160ce6 Mon Sep 17 00:00:00 2001 From: Mark Lawlor Date: Fri, 10 Oct 2025 17:28:22 +1000 Subject: [PATCH 1/2] fix: add warning for lightningcss@1.30.2 --- src/compiler/lightningcss-loader.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/compiler/lightningcss-loader.ts b/src/compiler/lightningcss-loader.ts index 84fb1478..143a8495 100644 --- a/src/compiler/lightningcss-loader.ts +++ b/src/compiler/lightningcss-loader.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ export function lightningcssLoader() { let lightningcssPath: string | undefined; @@ -28,11 +29,29 @@ export function lightningcssLoader() { ); } - // eslint-disable-next-line @typescript-eslint/no-require-imports const { transform: lightningcss, Features } = require( lightningcssPath, ) as typeof import("lightningcss"); + try { + const lightningcssPackageJSONPath = require.resolve("../../package.json", { + paths: [lightningcssPath], + }); + + const packageJSON = require(lightningcssPackageJSONPath) as Record< + string, + unknown + >; + + if (packageJSON.version === "1.30.2") { + throw new Error( + "[react-native-css] lightningcss version 1.30.2 has a critical bug that breaks compilation. Please pin the version of lightingcss to 1.30.1; or try upgrading.", + ); + } + } catch { + // Intentionally left empty + } + return { lightningcss, Features, From 770608d9e743301e9721fb8e596275877f8d1439 Mon Sep 17 00:00:00 2001 From: Mark Lawlor Date: Sat, 11 Oct 2025 14:46:49 +1000 Subject: [PATCH 2/2] Update src/compiler/lightningcss-loader.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/compiler/lightningcss-loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/lightningcss-loader.ts b/src/compiler/lightningcss-loader.ts index 143a8495..5565e74d 100644 --- a/src/compiler/lightningcss-loader.ts +++ b/src/compiler/lightningcss-loader.ts @@ -45,7 +45,7 @@ export function lightningcssLoader() { if (packageJSON.version === "1.30.2") { throw new Error( - "[react-native-css] lightningcss version 1.30.2 has a critical bug that breaks compilation. Please pin the version of lightingcss to 1.30.1; or try upgrading.", + "[react-native-css] lightningcss version 1.30.2 has a critical bug that breaks compilation. Please pin the version of lightningcss to 1.30.1; or try upgrading.", ); } } catch {