diff --git a/change/@fluentui-react-jsx-runtime-0290dc47-fd60-47c7-bc75-6d55b6beb5e6.json b/change/@fluentui-react-jsx-runtime-0290dc47-fd60-47c7-bc75-6d55b6beb5e6.json new file mode 100644 index 00000000000000..9fb83bf0d06544 --- /dev/null +++ b/change/@fluentui-react-jsx-runtime-0290dc47-fd60-47c7-bc75-6d55b6beb5e6.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: strip comments for JSX pragma", + "packageName": "@fluentui/react-jsx-runtime", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/scripts/tasks/src/swc.ts b/scripts/tasks/src/swc.ts index 1eef745e21ba6c..1ff17d1dcc274d 100644 --- a/scripts/tasks/src/swc.ts +++ b/scripts/tasks/src/swc.ts @@ -43,6 +43,11 @@ async function swcTransform(options: Options) { outputPath, }); + // Strip @jsx comments, see https://github.com/microsoft/fluentui/issues/29126 + const resultCode = result.code + .replace('/** @jsxRuntime automatic */', '') + .replace('/** @jsxImportSource @fluentui/react-jsx-runtime */', ''); + const compiledFilePath = path.resolve(packageRoot, fileName.replace(`${sourceRootDirName}`, outputPath)); //Create directory folder for new compiled file(s) to live in. @@ -50,7 +55,7 @@ async function swcTransform(options: Options) { const compiledFilePathJS = `${compiledFilePath.replace(tsFileExtensionRegex, '.js')}`; - await fs.promises.writeFile(compiledFilePathJS, result.code); + await fs.promises.writeFile(compiledFilePathJS, resultCode); if (result.map) { await fs.promises.writeFile(`${compiledFilePathJS}.map`, result.map); }