Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-planets-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: write generated tsconfig to `node_modules/$app/tsconfig.json` so that tools with simplified tsconfig resolution can find it
4 changes: 2 additions & 2 deletions packages/kit/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ if (!command) {
}

if (command === 'sync') {
// create placeholder node_modules/$app/tsconfig/tsconfig.json if necessary, to squelch warnings.
// create placeholder node_modules/$app/tsconfig.json if necessary, to squelch warnings.
// this isn't bulletproof — if someone has some esoteric config, it will continue
// to harmlessly warn — but we handle the 90% case and clean up after ourselves
const dir = 'node_modules/$app/tsconfig';
const dir = 'node_modules/$app';
const base_tsconfig = `${dir}/tsconfig.json`;
const base_tsconfig_json = '{}';

Expand Down
3 changes: 2 additions & 1 deletion packages/kit/src/core/sync/write_tsconfig/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export function write_tsconfig(kit, root) {
* @param {ValidatedKitConfig['typescript']['config']} [transform] TODO get rid of this
*/
function write_parent_tsconfig(root, dir, id, config, example, transform) {
const out_file = path.join(root, `node_modules/${id}/tsconfig.json`);
// simplified tsconfig resolvers (e.g. Playwright's) only find `${id}.json`, not `${id}/tsconfig.json`
const out_file = path.join(root, `node_modules/${id}.json`);

let normalized = normalize_config(out_file, config);
normalized = transform?.(normalized) ?? normalized;
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ export interface KitConfig {
* A function that allows you to edit the generated `tsconfig.json`. You can mutate the config (recommended) or return a new one.
* This is useful for extending a shared `tsconfig.json` in a monorepo root, for example.
*
* Note that any paths configured here should be relative to the generated config file, which is written to `node_modules/$app/tsconfig/tsconfig.json`.
* Note that any paths configured here should be relative to the generated config file, which is written to `node_modules/$app/tsconfig.json`.
*
* @default (config) => config
* @since 1.3.0
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ declare module '@sveltejs/kit' {
* A function that allows you to edit the generated `tsconfig.json`. You can mutate the config (recommended) or return a new one.
* This is useful for extending a shared `tsconfig.json` in a monorepo root, for example.
*
* Note that any paths configured here should be relative to the generated config file, which is written to `node_modules/$app/tsconfig/tsconfig.json`.
* Note that any paths configured here should be relative to the generated config file, which is written to `node_modules/$app/tsconfig.json`.
*
* @default (config) => config
* @since 1.3.0
Expand Down
Loading