首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法使用JSX,除非在我启动纱线时提供了“--jsx”标志

无法使用JSX,除非在我启动纱线时提供了“--jsx”标志
EN

Stack Overflow用户
提问于 2020-12-08 10:31:04
回答 2查看 2.1K关注 0票数 1

我做了

  • 我做了纱线的开始,http://localhost:3000/很成功,但是出现了很多问题

$ yarn start也是npm run start纱线运行版本1.22.4$react脚本启动

代码语言:javascript
运行
复制
The following changes are being made to your tsconfig.json file:
  - compilerOptions.jsx must be react-jsx (to support the new JSX transform in React 17)

i 「wds」: Project is running at http://192.168.56.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\taiga\Github\Typescript\eslint-app\example\public
i 「wds」: 404s will fallback to /
Starting the development server...
Compiled successfully!

You can now view example in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.56.1:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

错误

  • Cannot use JSX unless the '--jsx' flag is provided
  • Module './App' was resolved to 'c:/Users/taiga/Github/Typescript/eslint-app/example/src/App.tsx', but '--jsx' is not set.
  • Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.

我试着

我试过这个

我是我的回购

我的目标

  • 使用lint a react-typescript-app
EN

Stack Overflow用户

发布于 2021-05-10 08:32:53

这是一个与创建-反应-应用程序(CRA)脚本悬而未决的问题。唯一适合我的解决方案是在.env文件中添加下面的配置(在项目根目录中)。

代码语言:javascript
运行
复制
DISABLE_NEW_JSX_TRANSFORM=true
票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65197219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档