Skip to content

Commit

Permalink
fix: should re-export createElement for backwards compatibility (#7002)
Browse files Browse the repository at this point in the history
* fix: should re-export createElement for backwards compatibility

* feat: createElement

* chore: swc helpers

* chore: swc-helpers
  • Loading branch information
HomyeeKing authored Nov 8, 2024
1 parent 4130611 commit 75db27e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/jsx-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"jsx-runtime"
],
"dependencies": {
"style-unit": "^3.0.4"
"style-unit": "^3.0.4",
"@swc/helpers": "^0.5.13"
},
"devDependencies": {
"@ice/pkg": "^1.5.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/jsx-runtime/src/createElement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement as reactCreateElement } from 'react';
import { hijackElementProps } from './style.js';
export function createElement(type: any, props: any, ...children: any[]) {
return reactCreateElement(type, hijackElementProps(props), ...children);
}
1 change: 1 addition & 0 deletions packages/jsx-runtime/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './prod.js';
export { createElement } from './createElement.js';
21 changes: 15 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75db27e

Please sign in to comment.