Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert back to the old JSX transform #2122

Merged
merged 8 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-bags-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-react': patch
---

The new JSX transform added in [v3.12.0](https://github.com/iTwin/iTwinUI/releases/tag/%40itwin%2Fitwinui-react%403.12.0) has been reverted, because React 17 [doesn't properly support it](https://github.com/facebook/react/issues/20235).
6 changes: 5 additions & 1 deletion packages/itwinui-react/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const swcOptions = {
'jsc.parser.syntax=typescript',
'jsc.parser.tsx=true',
'jsc.transform.react.useBuiltins=true',
'jsc.transform.react.runtime=automatic',

// We cannot (currently) use the new JSX transform, because it relies on ESM exports
// which are not available in React 17. See https://github.com/facebook/react/issues/20235
// 'jsc.transform.react.runtime=automatic',

'jsc.target=es2020',
'jsc.minify.format.comments=false',
'jsc.externalHelpers=true',
Expand Down
16 changes: 11 additions & 5 deletions packages/itwinui-react/src/utils/icons/StatusIconMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { SvgInfoCircular } from './SvgInfoCircular.js';
import { SvgStatusError } from './SvgStatusError.js';
import { SvgStatusSuccess } from './SvgStatusSuccess.js';
import { SvgStatusWarning } from './SvgStatusWarning.js';
import type { CommonProps } from '../props.js';
r100-stack marked this conversation as resolved.
Show resolved Hide resolved

export const StatusIconMap = {
negative: (args?: CommonProps) => <SvgStatusError aria-hidden {...args} />,
positive: (args?: CommonProps) => <SvgStatusSuccess aria-hidden {...args} />,
warning: (args?: CommonProps) => <SvgStatusWarning aria-hidden {...args} />,
informational: (args?: CommonProps) => (
negative: (args?: React.ComponentPropsWithoutRef<'svg'>) => (
<SvgStatusError aria-hidden {...args} />
),
positive: (args?: React.ComponentPropsWithoutRef<'svg'>) => (
<SvgStatusSuccess aria-hidden {...args} />
),
warning: (args?: React.ComponentPropsWithoutRef<'svg'>) => (
<SvgStatusWarning aria-hidden {...args} />
),
informational: (args?: React.ComponentPropsWithoutRef<'svg'>) => (
<SvgInfoCircular aria-hidden {...args} />
),
};
2 changes: 1 addition & 1 deletion packages/itwinui-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"esModuleInterop": true,
"sourceMap": false,
"allowJs": false,
"jsx": "react-jsx",
"jsx": "react",
"moduleResolution": "NodeNext",
"traceResolution": false,
"forceConsistentCasingInFileNames": true,
Expand Down
3 changes: 3 additions & 0 deletions packages/itwinui-react/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx"
},
// TODO: Test all the files, and not just the Table files or just the build files.
"include": ["src/**/*.test.*", "src/**/*.types-test.*"]
}
Loading