sveltejs / vite-plugin-svelte

Svelte plugin for http://vitejs.dev/
MIT License
864 stars 105 forks source link

Allow to silent the warning "The following packages have a svelte field in their package.json but no exports condition for svelte." #963

Closed rallets closed 3 months ago

rallets commented 3 months ago

Describe the problem

Hi, I'm using a 3rd party library and while building with vite and rollup, I get a warning saying:

WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.
simple-svelte-autocomplete@2.5.2
Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.

I search previous issues but I wasn't lucky in finding a solution to silent this warning message.

I already tried with onwarn in rollup and in the plugin config, but it looks this warning is coming from another source.

Any tips?

Describe the proposed solution

Allow to silent the warning

Alternatives considered

Emit the warning via onwarn

Importance

nice to have

dominikg commented 3 months ago

The first thing you should do is report it to the package that got flagged by this warning.

For this specific package it has already been reported on their github, you may want to add your thumbsup: https://github.com/pstanoev/simple-svelte-autocomplete/issues/218

You can use vitePlugin.experimental.disableSvelteResolveWarnings: true in your svelte.config.js to silence this warning, or change the logLevel to error if you don't want any warnings.