diff options
Diffstat (limited to 'ext/js/script')
-rw-r--r-- | ext/js/script/dynamic-loader-sentinel.js | 3 | ||||
-rw-r--r-- | ext/js/script/dynamic-loader.js | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/ext/js/script/dynamic-loader-sentinel.js b/ext/js/script/dynamic-loader-sentinel.js index cb03b0b9..3c06fc02 100644 --- a/ext/js/script/dynamic-loader-sentinel.js +++ b/ext/js/script/dynamic-loader-sentinel.js @@ -18,4 +18,5 @@ import {yomitan} from '../yomitan.js'; -yomitan.trigger('dynamicLoaderSentinel', {script: document.currentScript}); + +yomitan.trigger('dynamicLoaderSentinel', {script: import.meta.url}); diff --git a/ext/js/script/dynamic-loader.js b/ext/js/script/dynamic-loader.js index ec95ff03..2abc9e04 100644 --- a/ext/js/script/dynamic-loader.js +++ b/ext/js/script/dynamic-loader.js @@ -126,6 +126,7 @@ export const dynamicLoader = (() => { if (node !== null) { continue; } const script = document.createElement('script'); + script.type = 'module'; script.async = false; script.src = url; parent.appendChild(script); @@ -140,7 +141,7 @@ export const dynamicLoader = (() => { const sentinelEventName = 'dynamicLoaderSentinel'; const sentinelEventCallback = (e) => { - if (e.script !== script) { return; } + if (e.script !== script.src) { return; } yomitan.off(sentinelEventName, sentinelEventCallback); parent.removeChild(script); resolve(); |