在我的React项目中,我在webpack配置中定义了一个模块别名.我想开始转向Typescript.
//我试图尽可能地简化设置
这是我tsconfig.json在根文件夹中的:
{
"compilerOptions": {
"target": "es6",
"module": "es6",
"moduleResolution": "node",
"jsx": "react",
"noImplicitAny": true,
"strictNullChecks": true,
"sourceMap": true,
"lib": [
"dom",
"es2015",
"es2016"
],
"baseUrl": "./src",
"paths": {
"app": ["./app"]
}
},
"include": [
"src/**/*"
]
}
Run Code Online (Sandbox Code Playgroud)
这是我的项目结构:
[rootDir]
|
|- [src]
| |
| |-[app]
| |
| |-[components]
| | ... react components live here
| |- Test.tsx
| |- SomeComponent.tsx
| |- index.js (export { default as Test } from './Test')
|
|- …Run Code Online (Sandbox Code Playgroud)