From ecd382b36c5f2161cb246f5337daafca6ecf2753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Mi=C5=9Btal?= Date: Sat, 30 Dec 2023 12:38:28 +0100 Subject: [PATCH 1/2] Use `Bundler` as `moduleResolution` in ts templates --- .../templates/react-ts/src/client/tsconfig.json | 1 + .../templates/vanilla-ts/src/client/tsconfig.json | 3 ++- create-vite-express/templates/vue-ts/src/client/tsconfig.json | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/create-vite-express/templates/react-ts/src/client/tsconfig.json b/create-vite-express/templates/react-ts/src/client/tsconfig.json index 46f4260..fa6f55c 100644 --- a/create-vite-express/templates/react-ts/src/client/tsconfig.json +++ b/create-vite-express/templates/react-ts/src/client/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "ESNext", + "moduleResolution": "Bundler", "jsx": "react-jsx" } } diff --git a/create-vite-express/templates/vanilla-ts/src/client/tsconfig.json b/create-vite-express/templates/vanilla-ts/src/client/tsconfig.json index f37a104..e659ea0 100644 --- a/create-vite-express/templates/vanilla-ts/src/client/tsconfig.json +++ b/create-vite-express/templates/vanilla-ts/src/client/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "ESNext" + "module": "ESNext", + "moduleResolution": "Bundler" } } diff --git a/create-vite-express/templates/vue-ts/src/client/tsconfig.json b/create-vite-express/templates/vue-ts/src/client/tsconfig.json index f37a104..e659ea0 100644 --- a/create-vite-express/templates/vue-ts/src/client/tsconfig.json +++ b/create-vite-express/templates/vue-ts/src/client/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "ESNext" + "module": "ESNext", + "moduleResolution": "Bundler" } } From d4a964d26002c9d1786a2fd96fefdb31ff7f5bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Mi=C5=9Btal?= Date: Sat, 30 Dec 2023 12:38:53 +0100 Subject: [PATCH 2/2] Run typecheck in ts templates tests --- tests/cli.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/cli.test.ts b/tests/cli.test.ts index 0b8ecdb..8186ff1 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -22,6 +22,16 @@ for (const template of templates) { await expectCommandOutput("yarn start", [/Running in/, /production/]); it("production build works"); + // Vue needs Volar extension to support .vue files correctly in TS LS + // https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin + // so it's easier to just ignore it + if (template.includes("-ts") && !template.includes("vue")) { + await expectCommandOutput( + "yarn tsc -p src/client/tsconfig.json --noEmit", + ); + it("client passes typecheck"); + } + process.chdir(baseDir); done(); });