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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
10e415655c
commit
3fc319ea36
@@ -17,10 +17,12 @@ const resolveFbStubsToFbPlugin: Plugin = {
|
|||||||
name: 'resolve-fb-stubs-to-fb',
|
name: 'resolve-fb-stubs-to-fb',
|
||||||
setup({onResolve}) {
|
setup({onResolve}) {
|
||||||
onResolve({filter: /fb-stubs/}, (args) => {
|
onResolve({filter: /fb-stubs/}, (args) => {
|
||||||
|
let moduleName = args.path.replace('fb-stubs', 'fb');
|
||||||
|
if (!moduleName.endsWith('.tsx')) {
|
||||||
|
moduleName = `${moduleName}.tsx`;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
path: require.resolve(args.path.replace('fb-stubs', 'fb'), {
|
path: path.resolve(args.resolveDir, moduleName),
|
||||||
paths: [args.resolveDir],
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user