Skip to content

Commit 53249fe

Browse files
marklawlorCopilot
andauthored
fix: add warning for [email protected] (#215)
* fix: add warning for [email protected] * Update src/compiler/lightningcss-loader.ts Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 0acc293 commit 53249fe

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/compiler/lightningcss-loader.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
export function lightningcssLoader() {
23
let lightningcssPath: string | undefined;
34

@@ -28,11 +29,29 @@ export function lightningcssLoader() {
2829
);
2930
}
3031

31-
// eslint-disable-next-line @typescript-eslint/no-require-imports
3232
const { transform: lightningcss, Features } = require(
3333
lightningcssPath,
3434
) as typeof import("lightningcss");
3535

36+
try {
37+
const lightningcssPackageJSONPath = require.resolve("../../package.json", {
38+
paths: [lightningcssPath],
39+
});
40+
41+
const packageJSON = require(lightningcssPackageJSONPath) as Record<
42+
string,
43+
unknown
44+
>;
45+
46+
if (packageJSON.version === "1.30.2") {
47+
throw new Error(
48+
"[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.",
49+
);
50+
}
51+
} catch {
52+
// Intentionally left empty
53+
}
54+
3655
return {
3756
lightningcss,
3857
Features,

0 commit comments

Comments
 (0)