1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Update custom-server-typescript example (#3936)

- Add "jsx": "preserve" to tsconfig.json
- Rename lib to production-server to remove incompatibility with other examples

Context: https://github.com/zeit/next.js/pull/3838#issuecomment-370189242 and below
This commit is contained in:
Alexander Kachkaev 2018-03-05 08:49:48 +00:00 committed by Tim Neutkens
parent 23c3ef88c9
commit 39be7183a5
3 changed files with 6 additions and 3 deletions

View file

@ -38,3 +38,5 @@ now
## The idea behind the example ## The idea behind the example
The example shows how you can use [TypeScript](https://typescriptlang.com) on both the server and the client while using [Nodemon](https://nodemon.io/) to live reload the server code without affecting the Next.js universal code. The example shows how you can use [TypeScript](https://typescriptlang.com) on both the server and the client while using [Nodemon](https://nodemon.io/) to live reload the server code without affecting the Next.js universal code.
Server entry point is `server/index.ts` in development and `production-server/index.js` in production.
The second directory should be added to `.gitignore`.

View file

@ -2,7 +2,7 @@
"scripts": { "scripts": {
"dev": "nodemon server/index.ts", "dev": "nodemon server/index.ts",
"build": "next build && tsc --module commonjs", "build": "next build && tsc --module commonjs",
"start": "NODE_ENV=production node lib/index.js" "start": "NODE_ENV=production node production-server/index.js"
}, },
"dependencies": { "dependencies": {
"next": "latest", "next": "latest",

View file

@ -3,6 +3,7 @@
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"jsx": "preserve",
"allowJs": true, "allowJs": true,
"moduleResolution": "node", "moduleResolution": "node",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
@ -21,7 +22,7 @@
"es2015", "es2015",
"es2016" "es2016"
], ],
"outDir": "lib/" "outDir": "production-server/"
}, },
"include": [ "include": [
"server/**/*.ts" "server/**/*.ts"