-
Notifications
You must be signed in to change notification settings - Fork 350
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
feat(uni-builder): add unified builder for Modern.js #5092
Conversation
🦋 Changeset detectedLatest commit: edb3300 The changes in this PR will be included in the next version bump. This PR includes changesets to release 271 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
||
if (isProd) { | ||
baseBabelConfig.plugins?.push([ | ||
require.resolve('babel-plugin-transform-react-remove-prop-types'), |
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.
babel-plugin-transform-react-remove-prop-types 这个 plugin 默认会移除组件的 propTypes 属性。
请问在 React 配置中默认加上这个移除组件的propTypes静态属性是一个通用的做法吗?如果用户想关掉这个怎么操作呢?
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.
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.
目前需要手动通过 tools.babel 修改配置移除,后面会提供对应配置项。
在没有配置 source.include 的情况下,是只对项目 src 下的所有文件 和 项目外的 ts|tsx|jsx|mts|cts 文件编译;如果命中前面的规则但不希望转译的话,可以通过 source.exclude 排除
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.
目前需要手动通过 tools.babel 修改配置移除,后面会提供对应配置项。
在没有配置 source.include 的情况下,是只对项目 src 下的所有文件 和 项目外的 ts|tsx|jsx|mts|cts 文件编译;如果命中前面的规则但不希望转译的话,可以通过 source.exclude 排除
明白。不过这个配置可能会导致源码走 modernjs 的 babel 处理 react 的静态属性。很多用户不太关心这些配置,直接用的默认配置,但是默认配置会出现上面说的报错。
目前所有使用默认配置的用户都有可能在生产环境出现这个报错。团队内部是否可以讨论一下这个插件是不是默认加上。
Summary
background: web-infra-dev/rsbuild#239 (comment)
Related Links
Checklist
pnpm run change
.