-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: when code has declare @jsx createElement comment, swc config runtime: 'classic' #5976
Conversation
@@ -69,7 +69,18 @@ const plugin: Plugin<CompatRaxOptions> = (options = {}) => ({ | |||
config.swcOptions = merge(config.swcOptions || {}, { | |||
compilationConfig: (source: string) => { | |||
const isRaxComponent = /from\s['"]rax['"]/.test(source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package 里面 version 加一下,changelog 补充
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 changeset 流程:
- 不需要修改版本号
- 项目根路径下执行 pnpm run changeset, 根据 cli 提示操作
- 提交所有文件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 changeset 流程:
- 不需要修改版本号
- 项目根路径下执行 pnpm run changeset, 根据 cli 提示操作
- 提交所有文件
这个好像还没有补充到 CONTRIBUTING.md 中
}, | ||
}, | ||
}; | ||
} else if (isRaxComponent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasJSXComment 的逻辑放在 isRaxComponent 吧,这个逻辑只在 rax 下生效。
@@ -1,5 +1,9 @@ | |||
# Changelog | |||
|
|||
## 0.1.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照卓凌提的来就好了,这个不需要手动提交了
@@ -69,7 +69,19 @@ const plugin: Plugin<CompatRaxOptions> = (options = {}) => ({ | |||
config.swcOptions = merge(config.swcOptions || {}, { | |||
compilationConfig: (source: string) => { | |||
const isRaxComponent = /from\s['"]rax['"]/.test(source); | |||
const hasJSXComment = source.indexOf('@jsx createElement') !== -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个检测可以卸载判断条件内部,提升效率
fix: when code has declare @jsx createElement comment, swc config runtime: 'classic'