构建:除非提供了'--jsx'标志,否则无法使用JSX [英] Build: Cannot use JSX unless the '--jsx' flag is provided

查看:332
本文介绍了构建:除非提供了'--jsx'标志,否则无法使用JSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有React的VS 2013和tsx文件.我可以手动构建我的项目.(右键单击并构建解决方案)

I am using VS 2013 and tsx files with react. I can build my project manually just fine. (Right click and build solution)

但是,当我尝试在Azure上发布时,VS尝试再次构建,但是那时我收到了所有这样的错误提示:

But when I try to publish on Azure, VS tries to build again but at that time I am getting all bunch of errors stated as:

Error   2   Build: Cannot use JSX unless the '--jsx' flag is provided. 

并指向我的tsx文件.

and points to my tsx files.

Azure Publish似乎使用了与VS 2013不同的构建步骤.

Seems like Azure Publish using different kind of build steps than VS 2013 does.

如何解决此问题?

推荐答案

我在我的 tsconfig.json 中添加了"jsx":"react" 来解决此错误:

I added "jsx": "react" to my tsconfig.json to resolve this error:

{
    "compileOnSave": true,
    "compilerOptions": {
        "target": "es6",
        "outFile": "Content/app.js",
        "sourceMap": true,
        "jsx": "react"
    }
}

这篇关于构建:除非提供了'--jsx'标志,否则无法使用JSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆