@samitouri / QOS-React-1 / commits / e39b380a21

[mcp] Fix unresolved imports (#33105)

We need to explicitly import the modules so they'll be inlined correctly into the bundle.

lauren committed May 2, 2025 at 16:54 UTC e39b380a21aa4ef48d5880aa2c800ec5b1b044bd
1 file changed +8 -6
compiler/packages/react-mcp-server/src/tools/runtimePerf.ts
+8 -6
@@ -1,5 +1,11 @@
1 import * as babel from '@babel/core';
2 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';
9
10 type PerformanceResults = {
11 renderTime: number;
@@ -25,15 +31,11 @@ export async function measurePerformance(
31 code: string,
32 iterations: number,
33 ): Promise<PerformanceResults> {
28 - const babelOptions = {
34 + const babelOptions: babel.TransformOptions = {
35 filename: 'anonymous.tsx',
36 configFile: false,
37 babelrc: false,
32 - presets: [
33 - '@babel/preset-typescript',
34 - '@babel/preset-env',
35 - '@babel/preset-react',
36 - ],
38 + presets: [babelPresetTypescript, babelPresetEnv, babelPresetReact],
39 };
40
41 const parsed = await babel.parseAsync(code, babelOptions);