[kbn/optimizer] require fsevents on macos (#67147)
This commit is contained in:
parent
9e39a13a76
commit
ffe7341f27
|
@ -39,10 +39,26 @@ export type OptimizerUpdate = Update<OptimizerEvent, OptimizerState>;
|
|||
export type OptimizerUpdate$ = Rx.Observable<OptimizerUpdate>;
|
||||
|
||||
export function runOptimizer(config: OptimizerConfig) {
|
||||
return Rx.defer(async () => ({
|
||||
startTime: Date.now(),
|
||||
cacheKey: await getOptimizerCacheKey(config),
|
||||
})).pipe(
|
||||
return Rx.defer(async () => {
|
||||
if (process.platform === 'darwin') {
|
||||
try {
|
||||
require.resolve('fsevents');
|
||||
} catch (error) {
|
||||
if (error.code === 'MODULE_NOT_FOUND') {
|
||||
throw new Error(
|
||||
'`fsevents` module is not installed, most likely because you need to follow the instructions at https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md and re-bootstrap Kibana'
|
||||
);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
startTime: Date.now(),
|
||||
cacheKey: await getOptimizerCacheKey(config),
|
||||
};
|
||||
}).pipe(
|
||||
mergeMap(({ startTime, cacheKey }) => {
|
||||
const bundleCacheEvent$ = getBundleCacheEvent$(config, cacheKey).pipe(
|
||||
observeOn(Rx.asyncScheduler),
|
||||
|
|
Loading…
Reference in a new issue