Add server add-on babel transform

Reviewed By: antonk52

Differential Revision: D34393126

fbshipit-source-id: d910392d9ac7e7a44e2e9ede690a6bed77f018c7
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent 01a5f3da90
commit 9449f61adb
2 changed files with 48 additions and 3 deletions

View File

@@ -0,0 +1,47 @@
/**
* Copyright (c) Meta Platforms, Inc. and 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';
// Copy-paste from transform-plugin with @babel/preset-env instead of @babel/preset-react
const presets = [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
];
const plugins = [
require('./electron-requires'),
require('./plugin-flipper-requires'),
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});
}