小编drg*_*oss的帖子

rootDir 和 outDir 的意外行为

我正在尝试将 TypeScript 与 React Native 结合使用。

\n\n

这是我的tsconfig.json

\n\n
{\n    "compilerOptions": {\n        "target": "es2015",\n        "module": "es2015",\n        "jsx": "react",\n        "outDir": "build",\n        "rootDir": "src",\n        "allowSyntheticDefaultImports": true,\n        "noImplicitAny": true,\n        "experimentalDecorators": true,\n        "preserveConstEnums": true,\n        "allowJs": true,\n        "sourceMap": true\n    },\n    "filesGlob": [\n        "typings/index.d.ts",\n        "src/**/*.ts",\n        "src/**/*.tsx"\n    ],\n    "exclude": [\n        "index.android.js",\n        "index.ios.js",\n        "build",\n        "node_modules"\n    ],\n    "compileOnSave": false\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我希望将 src 目录中的所有 .ts(x) 文件编译到构建目录。

\n\n

预期的:

\n\n
MyAwesomeReactNativeApp/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.tsx\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 build/\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.js\n
Run Code Online (Sandbox Code Playgroud)\n\n

得到:

\n\n
MyAwesomeReactNativeApp/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.tsx\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 build/\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src/\n    \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 …
Run Code Online (Sandbox Code Playgroud)

typescript react-native

5
推荐指数
1
解决办法
9125
查看次数

标签 统计

react-native ×1

typescript ×1