相关疑难解决方法(0)

除非提供'--jsx'标志,否则无法使用JSX

我已经四处寻找解决这个问题的方法了.所有这些都建议添加"jsx": "react"到您的tsconfig.json文件.我做了什么.另外一个是补充"include: []",我也做了.但是,当我尝试编辑.tsx文件时,我仍然收到错误.下面是我的tsconfig文件.

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "allowJs": true,
        "checkJs": false,
        "jsx": "react",
        "outDir": "./build",
        "rootDir": "./lib",
        "removeComments": true,
        "noEmit": true,
        "pretty": true,
        "skipLibCheck": true,
        "strict": true,
        "moduleResolution": "node",
        "esModuleInterop": true
    },
    "include": [
        "./lib/**/*"
    ],
    "exclude": [
        "node_modules"
    ]
}
Run Code Online (Sandbox Code Playgroud)

任何的意见都将会有帮助.我正在使用babel 7来编译env,react和typescript预设的所有代码.如果你们需要更多文件来帮助调试这个,请告诉我.

jsx typescript reactjs tsx

36
推荐指数
13
解决办法
2万
查看次数

构建:除非提供'--jsx'标志,否则不能使用JSX

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

但是当我尝试在Azure上发布时,VS会再次尝试构建,但当时我收到的所有错误都表示为:

Error   2   Build: Cannot use JSX unless the '--jsx' flag is provided. 
Run Code Online (Sandbox Code Playgroud)

并指向我的tsx文件.

看起来像Azure Publish使用不同于VS 2013的构建步骤.

我该如何解决这个问题?

Azure发布错误

VS 2013错误

azure typescript visual-studio-2013 tsx

11
推荐指数
4
解决办法
8748
查看次数

标签 统计

tsx ×2

typescript ×2

azure ×1

jsx ×1

reactjs ×1

visual-studio-2013 ×1