From f5ad53b4c1d0ed787d6fdda10f1180f3b4bba958 Mon Sep 17 00:00:00 2001 From: Pedro Borges Date: Thu, 10 Oct 2024 11:34:27 -0300 Subject: [PATCH] Change TS module resolution --- packages/svelte/test-app/tsconfig.json | 4 +-- playgrounds/svelte4/resources/js/app.ts | 3 +- playgrounds/svelte4/resources/js/ssr.ts | 3 +- playgrounds/svelte4/tsconfig.json | 45 +++++++++++++------------ playgrounds/svelte5/resources/js/app.ts | 3 +- playgrounds/svelte5/resources/js/ssr.ts | 3 +- playgrounds/svelte5/tsconfig.json | 45 +++++++++++++------------ 7 files changed, 54 insertions(+), 52 deletions(-) diff --git a/packages/svelte/test-app/tsconfig.json b/packages/svelte/test-app/tsconfig.json index 90c8ca50e..b4af34b64 100644 --- a/packages/svelte/test-app/tsconfig.json +++ b/packages/svelte/test-app/tsconfig.json @@ -9,8 +9,8 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "module": "NodeNext", - "moduleResolution": "NodeNext" + "module": "ESNext", + "moduleResolution": "node" }, "include": ["*.d.ts", "*.ts", "*.js", "**/*.d.ts", "**/*.ts", "**/*.js", "**/*.svelte", "*.config.js", "*.config.cjs"] } diff --git a/playgrounds/svelte4/resources/js/app.ts b/playgrounds/svelte4/resources/js/app.ts index 34cf8257a..0a5c7e9aa 100644 --- a/playgrounds/svelte4/resources/js/app.ts +++ b/playgrounds/svelte4/resources/js/app.ts @@ -1,5 +1,4 @@ -import { createInertiaApp } from '@inertiajs/svelte' -import type { ResolvedComponent } from '@inertiajs/svelte' +import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte' createInertiaApp({ resolve: (name) => { diff --git a/playgrounds/svelte4/resources/js/ssr.ts b/playgrounds/svelte4/resources/js/ssr.ts index ff4261952..97b41c924 100644 --- a/playgrounds/svelte4/resources/js/ssr.ts +++ b/playgrounds/svelte4/resources/js/ssr.ts @@ -1,6 +1,5 @@ -import { createInertiaApp } from '@inertiajs/svelte' +import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte' import createServer from '@inertiajs/svelte/server' -import { ResolvedComponent } from '@inertiajs/svelte' createServer((page) => createInertiaApp({ diff --git a/playgrounds/svelte4/tsconfig.json b/playgrounds/svelte4/tsconfig.json index 472186421..14225cc39 100644 --- a/playgrounds/svelte4/tsconfig.json +++ b/playgrounds/svelte4/tsconfig.json @@ -1,23 +1,26 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "module": "NodeNext", - "moduleResolution": "NodeNext" - }, - "include": [ - "resources/**/*.d.ts", - "resources/**/*.ts", - "resources/**/*.js", - "resources/**/*.svelte", - "*.config.js", - "*.config.cjs" - ] + "extends": "@tsconfig/svelte/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "module": "ESNext", + "moduleResolution": "node", + "paths": { + "@inertiajs/svelte/server": ["../../node_modules/@inertiajs/svelte/dist/server"] + } + }, + "include": [ + "resources/**/*.d.ts", + "resources/**/*.ts", + "resources/**/*.js", + "resources/**/*.svelte", + "*.config.js", + "*.config.cjs" + ] } diff --git a/playgrounds/svelte5/resources/js/app.ts b/playgrounds/svelte5/resources/js/app.ts index 7f219af33..e595b3a28 100644 --- a/playgrounds/svelte5/resources/js/app.ts +++ b/playgrounds/svelte5/resources/js/app.ts @@ -1,6 +1,5 @@ -import { createInertiaApp } from '@inertiajs/svelte' +import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte' import { hydrate, mount } from 'svelte' -import type { ResolvedComponent } from '@inertiajs/svelte' createInertiaApp({ resolve: (name) => { diff --git a/playgrounds/svelte5/resources/js/ssr.ts b/playgrounds/svelte5/resources/js/ssr.ts index ff4261952..97b41c924 100644 --- a/playgrounds/svelte5/resources/js/ssr.ts +++ b/playgrounds/svelte5/resources/js/ssr.ts @@ -1,6 +1,5 @@ -import { createInertiaApp } from '@inertiajs/svelte' +import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte' import createServer from '@inertiajs/svelte/server' -import { ResolvedComponent } from '@inertiajs/svelte' createServer((page) => createInertiaApp({ diff --git a/playgrounds/svelte5/tsconfig.json b/playgrounds/svelte5/tsconfig.json index 472186421..14225cc39 100644 --- a/playgrounds/svelte5/tsconfig.json +++ b/playgrounds/svelte5/tsconfig.json @@ -1,23 +1,26 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "module": "NodeNext", - "moduleResolution": "NodeNext" - }, - "include": [ - "resources/**/*.d.ts", - "resources/**/*.ts", - "resources/**/*.js", - "resources/**/*.svelte", - "*.config.js", - "*.config.cjs" - ] + "extends": "@tsconfig/svelte/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "module": "ESNext", + "moduleResolution": "node", + "paths": { + "@inertiajs/svelte/server": ["../../node_modules/@inertiajs/svelte/dist/server"] + } + }, + "include": [ + "resources/**/*.d.ts", + "resources/**/*.ts", + "resources/**/*.js", + "resources/**/*.svelte", + "*.config.js", + "*.config.cjs" + ] }