You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+28-1
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,10 @@ Add the package to your dev dependencies:
15
15
yarn add relay-compiler-language-typescript --dev
16
16
```
17
17
18
+
## Configuration
19
+
20
+
### relay-compiler
21
+
18
22
Then configure your `relay-compiler` script to use it, like so:
19
23
20
24
```json
@@ -25,7 +29,7 @@ Then configure your `relay-compiler` script to use it, like so:
25
29
}
26
30
```
27
31
28
-
This is going to store all artifacts in a single directory, which you also need to instruct the Babel plugin to use:
32
+
This is going to store all artifacts in a single directory, which you also need to instruct `babel-plugin-relay` to use in your `.babelrc`:
29
33
30
34
```json
31
35
{
@@ -35,6 +39,29 @@ This is going to store all artifacts in a single directory, which you also need
35
39
}
36
40
```
37
41
42
+
### TypeScript
43
+
44
+
Also be sure to configure the TypeScript compiler to transpile to `es2015` modules and leave transpilation to `commonjs` modules up to Babel with the following `tsconfig.json` settings:
45
+
46
+
```json
47
+
{
48
+
"compilerOptions": {
49
+
"target": "es2015",
50
+
"module": "es2015"
51
+
}
52
+
}
53
+
```
54
+
55
+
The reason for this is that `tsc` would otherwise generate code where the imported `graphql` function is being namespaced (`react_relay_1` in this example):
0 commit comments