From 21e6f0d7a489919f5f6fa9b1c8817e5cb77dacfd Mon Sep 17 00:00:00 2001 From: Chance Strickland Date: Wed, 18 May 2022 09:28:50 -0500 Subject: [PATCH] null check --- packages/remix-dev/compiler/plugins/cssModulesPlugin.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/remix-dev/compiler/plugins/cssModulesPlugin.ts b/packages/remix-dev/compiler/plugins/cssModulesPlugin.ts index 6b93cb0b423..87db934fd0c 100644 --- a/packages/remix-dev/compiler/plugins/cssModulesPlugin.ts +++ b/packages/remix-dev/compiler/plugins/cssModulesPlugin.ts @@ -74,8 +74,9 @@ Install the dependency by running the following command, then restart your app. config, filePath: args.path, }); + let json = processed?.json || {}; return { - contents: JSON.stringify(processed?.json || {}), + contents: JSON.stringify(json), loader: "json", }; } catch (err: any) { @@ -114,7 +115,7 @@ export function cssModulesFakerPlugin( { filter: suffixMatcher, namespace: pluginNamespace + "-faker" }, async (args) => { let res = await assetsManifestPromiseRef.current; - let json = res?.cssModules?.moduleMap[args.path].json || {}; + let json = res?.cssModules?.moduleMap[args.path]?.json || {}; return { contents: JSON.stringify(json), loader: "json",