Skip to content

Commit e7082dd

Browse files
committed
adding typescript configuration to enable absolute imports
facebook/create-react-app#5118 (comment)
1 parent d5b3501 commit e7082dd

5 files changed

+48
-4
lines changed

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"version": "0.1.0",
1010
"private": true,
1111
"scripts": {
12-
"start": "cross-env NODE_PATH=src react-scripts start",
13-
"build": "cross-env NODE_PATH=src react-scripts build",
14-
"test": "cross-env NODE_PATH=src react-scripts test",
15-
"eject": "cross-env NODE_PATH=src react-scripts eject"
12+
"start": "react-scripts start",
13+
"build": "react-scripts build",
14+
"test": "react-scripts test",
15+
"eject": "react-scripts eject"
1616
},
1717
"dependencies": {
1818
"@sentry/browser": "^4.3.2",
@@ -45,6 +45,7 @@
4545
"recompose": "^0.30.0",
4646
"semantic-ui-react": "^0.84.0",
4747
"serve": "^10.1.1",
48+
"typescript": "^3.3.3",
4849
"uuid": "^3.3.2"
4950
},
5051
"devDependencies": {
@@ -61,6 +62,9 @@
6162
"mobx-react-devtools": "^6.0.3",
6263
"prettier": "^1.14.3"
6364
},
65+
"engines": {
66+
"node": "11.10.0"
67+
},
6468
"eslintConfig": {
6569
"extends": "react-app"
6670
},

src/react-app-env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

tsconfig.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"extends": "./tsconfig.paths.json",
3+
"compilerOptions": {
4+
"target": "es5",
5+
"lib": [
6+
"dom",
7+
"dom.iterable",
8+
"esnext"
9+
],
10+
"allowJs": true,
11+
"skipLibCheck": true,
12+
"esModuleInterop": true,
13+
"allowSyntheticDefaultImports": true,
14+
"strict": true,
15+
"forceConsistentCasingInFileNames": true,
16+
"module": "esnext",
17+
"moduleResolution": "node",
18+
"resolveJsonModule": true,
19+
"isolatedModules": true,
20+
"noEmit": true,
21+
"jsx": "preserve"
22+
},
23+
"include": [
24+
"src"
25+
]
26+
}

tsconfig.paths.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"src/*": ["src/*"]
6+
}
7+
}
8+
}

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -10462,6 +10462,11 @@ typedarray@^0.0.6:
1046210462
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1046310463
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1046410464

10465+
typescript@^3.3.3:
10466+
version "3.3.3"
10467+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221"
10468+
integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==
10469+
1046510470
ua-parser-js@^0.7.18:
1046610471
version "0.7.19"
1046710472
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"

0 commit comments

Comments
 (0)