Skip to content

Commit e39b380

Browse files
authored
[mcp] Fix unresolved imports (facebook#33105)
We need to explicitly import the modules so they'll be inlined correctly into the bundle.
1 parent 9de0304 commit e39b380

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

compiler/packages/react-mcp-server/src/tools/runtimePerf.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import * as babel from '@babel/core';
22
import puppeteer from 'puppeteer';
3+
// @ts-ignore
4+
import * as babelPresetTypescript from '@babel/preset-typescript';
5+
// @ts-ignore
6+
import * as babelPresetEnv from '@babel/preset-env';
7+
// @ts-ignore
8+
import * as babelPresetReact from '@babel/preset-react';
39

410
type PerformanceResults = {
511
renderTime: number;
@@ -25,15 +31,11 @@ export async function measurePerformance(
2531
code: string,
2632
iterations: number,
2733
): Promise<PerformanceResults> {
28-
const babelOptions = {
34+
const babelOptions: babel.TransformOptions = {
2935
filename: 'anonymous.tsx',
3036
configFile: false,
3137
babelrc: false,
32-
presets: [
33-
'@babel/preset-typescript',
34-
'@babel/preset-env',
35-
'@babel/preset-react',
36-
],
38+
presets: [babelPresetTypescript, babelPresetEnv, babelPresetReact],
3739
};
3840

3941
const parsed = await babel.parseAsync(code, babelOptions);

0 commit comments

Comments
 (0)