Fix flipper-server build
Summary: flipper-server build fails when a server add-on uses one of the ignored modules. For instance, React DevTools is goin got use `ws` which has an optional dependency on `utf-8-validate` and `bufferutil`. Even though it is optional, it is still required, and therefore picked up by Metro. This way it is silently ignored. Reviewed By: mweststrate Differential Revision: D34716514 fbshipit-source-id: a9d463d2d5d7c954e35d9a16f3da44ce17615673
This commit is contained in:
committed by
Facebook GitHub Bot
parent
26ea544f82
commit
b1bc31044d
@@ -11,7 +11,7 @@ import {CallExpression} from '@babel/types';
|
||||
import {NodePath} from '@babel/traverse';
|
||||
|
||||
import {resolve} from 'path';
|
||||
import {BUILTINS} from './electron-requires';
|
||||
import {BUILTINS, IGNORED_MODULES} from './electron-requires';
|
||||
|
||||
const pluginsRootDir = resolve(__dirname, '../../plugins');
|
||||
|
||||
@@ -44,7 +44,13 @@ module.exports = () => ({
|
||||
// yet we should exclude built-ins
|
||||
!(
|
||||
BUILTINS.includes(source) ||
|
||||
BUILTINS.some((moduleName) => source.startsWith(`${moduleName}/`))
|
||||
BUILTINS.some((moduleName) =>
|
||||
source.startsWith(`${moduleName}/`),
|
||||
) ||
|
||||
IGNORED_MODULES.includes(source) ||
|
||||
IGNORED_MODULES.some((moduleName) =>
|
||||
source.startsWith(`${moduleName}/`),
|
||||
)
|
||||
))
|
||||
) {
|
||||
return;
|
||||
|
||||
@@ -53,7 +53,7 @@ export const BUILTINS = [
|
||||
'@testing-library/dom',
|
||||
];
|
||||
|
||||
const IGNORED_MODULES = [
|
||||
export const IGNORED_MODULES = [
|
||||
'bufferutil',
|
||||
'utf-8-validate',
|
||||
'spawn-sync',
|
||||
@@ -92,3 +92,4 @@ module.exports = () => ({
|
||||
|
||||
// used by startWebServerDev to know which modules to stub
|
||||
module.exports.BUILTINS = BUILTINS;
|
||||
module.exports.IGNORED_MODULES = IGNORED_MODULES;
|
||||
|
||||
Reference in New Issue
Block a user