-
-
Notifications
You must be signed in to change notification settings - Fork 749
feat: support auto_parser #10664
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
base: main
Are you sure you want to change the base?
feat: support auto_parser #10664
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
CodSpeed Performance ReportMerging #10664 will not alter performanceComparing Summary
|
.merge(Some(Syntax::Typescript(TsSyntax { | ||
tsx: parser_type.is_jsx, | ||
..Default::default() | ||
}))); |
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.
this not only override the tsx option but also override other option is TsSyntax like decorators dts and https://github.com/swc-project/swc/blob/b68f27b164bb43fff8f3a2fd9fa13d993181b539/crates/swc_ecma_parser/src/lib.rs#L311
pub(crate) is_jsx: bool, | ||
} | ||
// return the parser type of a file based on its extension name | ||
// tsx -> typescript + jsx |
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.
unfortunately we may also need to consider mjs
mts
cts
cjs
, I'm not sure whether there's mtsx
ctsx
stuff
@@ -10,6 +10,33 @@ Rspack 提供了一个内置的 `builtin:swc-loader`,它是 [swc-loader](https | |||
|
|||
如果需要在项目中使用 `builtin:swc-loader`,可以参考下面的示例进行配置。 | |||
|
|||
### 根据文件后缀自动开启转译功能 |
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.
基于文件后缀识别syntax更准确些,这个配置和是否开启转译没啥关系
Summary
Support
autoParser
Option to solve this issue.Checklist