sveltejs / sveltejs/kit

`proxy+page.server.ts` files break refactoring/renaming (F2 in VS Code)

Open
#8,924 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

types / typescript
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

If a +page.server.ts is affected by a refactor (i.e. it imports a refactored module), VS Code tries to do the respective changes also in the proxy+page.server.ts files. This leads to multiple errors in VS Code. One is 'the file is newer...' (which can be disabled with "files.saveConflictResolution": "overwriteFileOnDisk") and the other is about EACCES permission when running SvelteKit in Docker which can't get worked-around (you can of course manually discard that message every time it pops up but there's no way to stop this behavior permanently, i.e. excluding files in VS Code or so).

Reproduction

I created a SvelteKit starter project, added a +page.server.ts but I couldn't get SvelteKit to generate these proxy+page.server.ts files. When are these created or what causes their creation?

Once I know, I am happy to create a repo.

Logs
Error in VS Codes after trying to refactor:
Failed to save 'proxy+page.server.ts': Unable to write file 'vscode-remote://wsl+ubuntu/home/[...]/.svelte-kit/types/src/routes/[...]/proxy+page.server.ts' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/u/[...]/.svelte-kit/types/src/routes/[...]/proxy+page.server.ts')
System Info
WSL2 with Ubuntu 22.04.1
Node 18
@sveltejs/adapter-node 1.1.6
@sveltejs/kit 1.3.10
VS Code, tested without any plugin | with the Svelte plugin | with the Svelte and Prettier plugin
Exactly the same with Neovim and coc-vim
Severity

serious, but I can work around it

Additional Information

I posted this here and not in the lang tools repo because there is also another issue in this repo related to these proxy files.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the refactoring in a SvelteKit starter project under WSL2 with the reported VS Code, Node 18, and adapter versions, then determine what causes proxy+page.server.ts files to be generated. Done means refactoring no longer tries to save those generated files or produces the reported conflict and EACCES errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.