Files
flipper/desktop/babel-transformer/src/transform-main.ts
Anton Nikolaev a2e77f5da0 Patch metro to avoid erasing "process" global var
Summary:
Patch for "metro" to avoid erasing of "process" global var during bundling.

Also removed "process" babel transform for main Electron process which was also made to workaround the same issue with "process" being erased.

Reviewed By: mweststrate

Differential Revision: D22389153

fbshipit-source-id: 569882e20534eedfca45509b8efe0186d335c681
2020-07-06 03:09:41 -07:00

41 lines
854 B
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {default as doTransform} from './transform';
import {default as getCacheKey} from './get-cache-key';
import {default as flipperEnv} from './flipper-env';
const presets = [
[
require('@babel/preset-env'),
{targets: {electron: flipperEnv.FLIPPER_ELECTRON_VERSION}},
],
];
const plugins = [require('./electron-requires-main')];
if (flipperEnv.FLIPPER_FB) {
plugins.unshift(require('./fb-stubs'));
}
module.exports = {
transform,
getCacheKey,
};
function transform({
filename,
options,
src,
}: {
filename: string;
options: any;
src: string;
}) {
return doTransform({filename, options, src, presets, plugins});
}