From 39be7183a5d6e0c82884b33f14bcf675cf3966e6 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 5 Mar 2018 08:49:48 +0000 Subject: [PATCH] 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 --- examples/custom-server-typescript/README.md | 2 ++ examples/custom-server-typescript/package.json | 2 +- examples/custom-server-typescript/tsconfig.json | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/custom-server-typescript/README.md b/examples/custom-server-typescript/README.md index 017a3823..93e44c2c 100644 --- a/examples/custom-server-typescript/README.md +++ b/examples/custom-server-typescript/README.md @@ -38,3 +38,5 @@ now ## 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. +Server entry point is `server/index.ts` in development and `production-server/index.js` in production. +The second directory should be added to `.gitignore`. diff --git a/examples/custom-server-typescript/package.json b/examples/custom-server-typescript/package.json index 8c7e7b1e..02a79422 100644 --- a/examples/custom-server-typescript/package.json +++ b/examples/custom-server-typescript/package.json @@ -2,7 +2,7 @@ "scripts": { "dev": "nodemon server/index.ts", "build": "next build && tsc --module commonjs", - "start": "NODE_ENV=production node lib/index.js" + "start": "NODE_ENV=production node production-server/index.js" }, "dependencies": { "next": "latest", diff --git a/examples/custom-server-typescript/tsconfig.json b/examples/custom-server-typescript/tsconfig.json index cb36798f..900e506d 100644 --- a/examples/custom-server-typescript/tsconfig.json +++ b/examples/custom-server-typescript/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "target": "esnext", "module": "esnext", + "jsx": "preserve", "allowJs": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, @@ -21,9 +22,9 @@ "es2015", "es2016" ], - "outDir": "lib/" + "outDir": "production-server/" }, "include": [ "server/**/*.ts" ] -} \ No newline at end of file +}