tsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx"
}
}
我怀疑,因为这个设置,所以我在用esbuild打包后运行时会报错,ReferenceError: React is not defined
项目中也出现了React.createElement 的片段。
但是如果把配置项改为"jsx":"react"
的话,每个tsx都得import React 感觉挺麻烦的。
有其他的办法使得esbuild把React打包进来吗?
搞了一天居然自己处理掉了。
处理方式也很简单,自己写一个文件 重新export React
贴两个esbuild官方文档
https://esbuild.github.io/con...
https://esbuild.github.io/api...