LoginSignup
0
0

More than 3 years have passed since last update.

Svelteで「XXX has unused export property 'XXX'...」と出たときの対処方法

Posted at

はじめに

とあるSvelteライブラリのドキュメントサイトをローカル環境で動かしてたところ(Contribute目的で)ログ上で
XXX has unused export property 'XXX'. If it is for external reference only, please consider using export const answerという警告ログが出ていた。
その時の対処方法を記事にする。

再現

unused export propertyと記載されている通り、プロパティ渡し先のコンポーネントで宣言はしてるけど、使用していないときに起こるようです。

index.svelte


<script>
  import Nested from './Nested.svelte';
</script>

<Nested count={10}/>

Nested.svelte

<script>
    export let count;
</script>

そうすると、、、

Warning

警告ログを確認することができました。

対応

今回の場合まったく使用してないプロパティなので、渡してる部分と宣言してる部分を削除することで警告ログは消える。
もちろん警告ログなので、放置していてもおそらく動作上に問題ないかと思います。(すごく気にはなるかと思いますが)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0