-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
bundler error when exporting from a svelte component module context script #7304
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
Comments
are you having some declare module "*.svelte" {
export default any
} ? |
Everything I have is in my test repository. |
Between now and then nothing has changed, everything inside that issue is still valid (the explanation why it happens). There's just nothing we can do against that other than relaxing the module declaration in Svelte core. You can add one on your own to relax it, that should work ( |
I personally wouldn't want to relax it to everything being For now, I've moved all of that stuff out of into a separate |
I'm going to close this as there's really nothing we can do about it. The solution is to avoid importing named bindings from
|
Describe the bug
Exports ( inside
<script lang="ts" context="module"></script>
cannot be imported outside of a svelte component, without a@rollup/plugin-typescript
error being thrown.It doesn't stop the build by default (on rollup, it does on webpack) and it still works in the end, however a warning will still be logged for each export on every build. This is not only annoying (100+ warnings on each save when developing) but it also make real errors harder to spot.
This issue is a follow-up to #5817, which is 2 years old.
Possible fix would be to make svelte declare each
.svelte
context="module"
exports in a.d.ts
file.I'm not very knowledgeable on how svelte works under the hood but since we're using a bundler I'm guessing this is possible with a pre-processor.
EDIT: a way to hide these specific warnings would be a great hack if this is not going to be fixed.
Reproduction
git clone https://github.com/Alexandre-Fernandez/svelte-rollup-typescript-bug
cd svelte-rollup-typescript-bug
npm i
npm run dev
check build log
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: