From a9ff0952f63a407420907b91cf7554ee55801dcb Mon Sep 17 00:00:00 2001 From: TomokiMiyauci Date: Thu, 8 Jul 2021 23:02:53 +0900 Subject: [PATCH] :bug: (svelte) Check ref before create script tag --- packages/svelte/lib/Utterances.svelte | 3 ++- packages/svelte/package.json | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/svelte/lib/Utterances.svelte b/packages/svelte/lib/Utterances.svelte index a930c6de..910a1afa 100644 --- a/packages/svelte/lib/Utterances.svelte +++ b/packages/svelte/lib/Utterances.svelte @@ -16,8 +16,9 @@ })() - let divRef: HTMLDivElement; + let divRef: HTMLDivElement | undefined; onMount(() => { + if(!divRef) return const scriptEl = createScriptElement({ repo, theme, diff --git a/packages/svelte/package.json b/packages/svelte/package.json index d1627395..8e369f25 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -13,7 +13,6 @@ "./package.json": "./package.json" }, "sideEffects": false, - "svelte": "lib/Utterances.svelte", "scripts": { "cz": "yarn --cwd ../.. cz", "commit": "yarn cz", @@ -40,5 +39,25 @@ "type": "git", "url": "https://github.com/TomokiMiyauci/utterances-component.git", "directory": "packages/svelte" + }, + "files": [ + "dist" + ], + "keywords": [ + "utterances", + "utterance", + "comment", + "comments", + "comment-system", + "vue", + "github", + "component", + "issue" + ], + "homepage": "https://github.com/TomokiMiyauci/utterances-component#readme", + "bugs": "https://github.com/TomokiMiyauci/utterances-component/issues", + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/tomoki_miyauci" } }