Teo*_*ahi 11 azure typescript visual-studio-2013 tsx
我正在使用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的构建步骤.
我该如何解决这个问题?
And*_*ugh 17
我添加"jsx": "react"
到我tsconfig.json
的解决此错误:
{
"compileOnSave": true,
"compilerOptions": {
"target": "es6",
"outFile": "Content/app.js",
"sourceMap": true,
"jsx": "react"
}
}
Run Code Online (Sandbox Code Playgroud)
在您tsconfig.json
添加一个属性 jsx 与 react value "jsx": "react"
。其次,您还应该包含文件以反映这样的编译器选项 (index.tsx)。
{
"compilerOptions": {
"outDir": "./build/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react"
},
"files": [
"./src/app/index.tsx"
]
}
Run Code Online (Sandbox Code Playgroud)
小智 0
tsc --jsx helloWorld.tsx http://staxmanade.com/2015/08/playing-with-typescript-and-jsx/
这可能对你有帮助
归档时间: |
|
查看次数: |
8748 次 |
最近记录: |