question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

emit_dts in svelte-kit package should respect the file excludes config

See original GitHub issue

Describe the problem

It’s fantastic that automatic type generation is included with the package command, however it seems svelte2tsx doesn’t accept any other configuration besides the lib root directory so when the types are generated with svelte-kit package, all files get generated types.

This is not desired when .stories.svelte, .test.ts or .test.svelte files (files that help test slots as a workaround) are next to the .svelte files in the lib directory.

Describe the proposed solution

It would be great to have the file excludes respected during type generation. I understand that it might be svelte2tsx that needs to be altered to make this work.

Alternatives considered

For now I think I’ll include a post-package script that cleans up files that match the glob in excludes. It’s a hacky workaround, why generate files that need to be cleaned up, right?

Importance

would make my life easier

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dummdidummcommented, Jul 16, 2021

Ok I think you convinced me. Generated d.ts files for files that are excluded would make you assume that these files exist when really they don’t. If this breaks you package then your excludes is wrong. So if you want you can go ahead and create a PR for this. I’ll maybe look into this some time next week.

0reactions
ignatiusmbcommented, Aug 23, 2021

Emitted declarations should not get included when the source file is excluded in .156 and above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration • Docs • SvelteKit
The directory that SvelteKit writes files to during dev and build . You should exclude this directory from version control. pathspermalink. ts. assets ......
Read more >
Package should obey .gitignore settings · Issue #3283 - GitHub
Describe the problem svelte-kit package currently exports all files in the $lib folder. There is a way to amend this in svelte.config.js as ......
Read more >
How do I exclude files from svelte-kit build? - Stack Overflow
UPDATE: SvelteKit 1.0.0-beta now requires pages/endpoints to follow a specific naming pattern, so explicit file exclusion should no longer be needed.
Read more >
Excluding test files from build in SvelteKit - StackBlitz
[svelte] Excluding test files - https://stackoverflow.com/q/69364069/6277151. ... com/edit/sveltekit-exclude-files). Enter to Rename, Shift+Enter to Preview.
Read more >
SvelteKit on Netlify
Deploy to our platform by using a SvelteKit adapter and optionally use Edge ... for your SvelteKit project, you need to update your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found