Skip to content

tsconfig.json error: Cannot write file 'src/service-worker.js' because it would overwrite input file #985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
frederikhors opened this issue Apr 12, 2021 · 8 comments

Comments

@frederikhors
Copy link
Contributor

frederikhors commented Apr 12, 2021

Describe the bug
Reading the docs about service worker I added an empty service-worker.js in my src dir.

I need it empty so vite sees it and produces the code to register it in the final bundle (I will fill in the file afterwards).

But now my (default) tsconfig.json is complaining with:

{
	"resource": "/c:/kit/tsconfig.json",
	"owner": "typescript",
	"severity": 8,
	"message": "Cannot write file 'c:/kit/src/service-worker.js' because it would overwrite input file.",
	"source": "ts",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 2
}

Why?

Information about your SvelteKit Installation:

Diagnostics
  • The output of npx envinfo --system --npmPackages svelte,@sveltejs/kit,vite --binaries --browsers:

    System:
    OS: Windows 10 10.0.19042
    Binaries:
    Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
    npm: 7.9.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
    @sveltejs/kit: 1.0.0-next.71 => 1.0.0-next.71
    svelte: 3.37.0 => 3.37.0
    vite: 2.1.5 => 2.1.5

  • Your adapter: static

Additional context
Maybe related to #716.

@Conduitry
Copy link
Member

I can't reproduce this on Linux. I haven't tried Windows.

@frederikhors
Copy link
Contributor Author

I get the error in VSCode too. The code is the same as https://github.com./frederikhors/protobuf-ts-issue-94.

@dummdidumm
Copy link
Member

Update Kit to the latest version and remove the $app/* and $service-worker entries from your paths in tsconfig. They are obsolete now.

@chbert
Copy link

chbert commented Apr 13, 2021

Update Kit to the latest version and remove the $app/* and $service-worker entries from your paths in tsconfig. They are obsolete now.

@dummdidumm I updated to "@sveltejs/kit": "^1.0.0-next.74", and removed the two lines from the tsconfig. But now the paths "$app/..." are not working anymore. Is there anything else that needs to be modified? Thanks in advance!

@ignatiusmb
Copy link
Member

But now the paths "$app/..." are not working anymore. Is there anything else that needs to be modified?

Updating and removing paths should be enough, can you elaborate on what's not working? Care to check again after restarting Svelte Language Server or reloading VSCode?

@chbert
Copy link

chbert commented Apr 13, 2021

@ignatiusmb thanks for the reply! Restarting Svelte Language Server did the trick 👍 Sorry, was completely unaware of that, in case somebody has the same issue: https://github.com./UnwrittenFun/svelte-vscode/blob/master/docs/preprocessors/typescript.md#:~:text=Restart%20the%20svelte%20language%20server&text=Hit%20ctrl%2Dshift%2Dp%20or,re%20now%20all%20set%20up!

Edit: see comment below

@dummdidumm
Copy link
Member

dummdidumm commented Apr 13, 2021

Small note: You referenced the very old repository which contains the now obsolete extension. This repo is where the development of it happens now and the official extension is this one

@ZerdoX-x
Copy link

ZerdoX-x commented Nov 24, 2021

For me this is not related to service worker. I've inited svelte project and I don't have it for now.

Reproducable like this: (choose yes to typesrcipt)

npm init svelte@next my-app
cd my-app
npm install
touch src/test.js
[{
	"resource": "/Users/zerdox/p/midas/frontend/tsconfig.json",
	"owner": "typescript",
	"severity": 8,
	"message": "Cannot write file '/Users/zerdox/p/midas/frontend/src/test.js' because it would overwrite input file.",
	"source": "ts",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 2
}]

EDIT: Sorry guys for ping. This is svelte vscode extension issue. After restarting it everything works fine. In case I will get any problems I'll open issue in svelte language tools repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants