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
Copy file name to clipboardExpand all lines: README.md
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@ As an example, we've included a small `src/lambda/hello.js` function, which will
6
6
7
7
[](https://app.netlify.com/start/deploy?repository=https://github.com/netlify/create-react-app-lambda)
8
8
9
+
## Video
10
+
11
+
Learn how to set this up yourself (and why everything is the way it is) from scratch in a video: https://www.youtube.com/watch?v=3ldSM98nCHI
12
+
9
13
## Babel/webpack compilation
10
14
11
15
All functions are compiled with webpack using the Babel Loader, so you can use modern JavaScript, import npm modules, etc., without any extra setup.
@@ -50,9 +54,11 @@ This will start the normal create-react-app dev server and open your app at `htt
50
54
51
55
Local in-app requests to the relative path `/.netlify/functions/*` will automatically be proxied to the local functions dev server.
52
56
57
+
## Typescript
58
+
53
59
<details>
54
60
<summary>
55
-
<b id="typescript">Typescript</b>
61
+
<b id="typescript">Click for instructions</b>
56
62
</summary>
57
63
You can use Typescript in both your React code (with `react-scripts` v2.1+) and your lambda functions )with `netlify-lambda` v1.1+). Follow these instructions:
58
64
@@ -61,18 +67,24 @@ You can use Typescript in both your React code (with `react-scripts` v2.1+) and
msg: `Hello world ${Math.floor(Math.random() *10)}`
86
+
msg: `Hello world ${Math.floor(Math.random() *10)}`,
87
+
params
76
88
})
77
89
};
78
90
@@ -88,6 +100,8 @@ You are free to set up your `tsconfig.json` and `tslint` as you see fit.
88
100
89
101
</details>
90
102
103
+
**If you want to try working in Typescript on the client and lambda side**: There are a bunch of small setup details to get right. Check https://github.com/sw-yx/create-react-app-lambda-typescript for a working starter.
104
+
91
105
## Service Worker
92
106
93
107
The service worker does not work with lambda functions out of the box. It prevents calling the function and returns the app itself instead ([Read more](https://github.com/facebook/create-react-app/issues/2237#issuecomment-302693219)). To solve this you have to eject and enhance the service worker configuration in the webpack config. Whitelist the path of your lambda function and you are good to go.
0 commit comments