From 124809a1f7e46452ae44b8751312f8140cd2e0a0 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 14 Sep 2023 08:31:14 +0000 Subject: [PATCH 1/2] fix: strip comments for JSX pragma --- scripts/tasks/src/swc.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); } From beeab0fb633769e7042f4225171ad4611f8eb777 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 14 Sep 2023 08:42:10 +0000 Subject: [PATCH 2/2] changelog for @fluentui/react-jsx-runtime --- ...t-jsx-runtime-0290dc47-fd60-47c7-bc75-6d55b6beb5e6.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-jsx-runtime-0290dc47-fd60-47c7-bc75-6d55b6beb5e6.json 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" +}