From 3fc319ea361a74d6961f64c4605abf1b15050efe Mon Sep 17 00:00:00 2001 From: Andrey Goncharov Date: Mon, 12 Dec 2022 05:46:01 -0800 Subject: [PATCH] Fix rebuilding plugins with intern references in dev mode when started as flipper-server Summary: require.resolve conflicts with require monkey patch in flipper-server Reviewed By: mweststrate Differential Revision: D41917678 fbshipit-source-id: 3bcd35ec4090cda85c372f23d6f8d0bcd9e7c74d --- desktop/pkg-lib/src/runBuild.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/desktop/pkg-lib/src/runBuild.tsx b/desktop/pkg-lib/src/runBuild.tsx index f6efab600..77de5cc35 100644 --- a/desktop/pkg-lib/src/runBuild.tsx +++ b/desktop/pkg-lib/src/runBuild.tsx @@ -17,10 +17,12 @@ const resolveFbStubsToFbPlugin: Plugin = { name: 'resolve-fb-stubs-to-fb', setup({onResolve}) { onResolve({filter: /fb-stubs/}, (args) => { + let moduleName = args.path.replace('fb-stubs', 'fb'); + if (!moduleName.endsWith('.tsx')) { + moduleName = `${moduleName}.tsx`; + } return { - path: require.resolve(args.path.replace('fb-stubs', 'fb'), { - paths: [args.resolveDir], - }), + path: path.resolve(args.resolveDir, moduleName), }; }); },