summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/settings.json1
-rw-r--r--ext/js/script/dynamic-loader-sentinel.js2
-rw-r--r--ext/js/script/dynamic-loader.js3
3 files changed, 4 insertions, 2 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index aa57bde2..6dea7915 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,5 +6,6 @@
"source.fixAll.eslint": true,
},
"eslint.format.enable": true,
+ "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.preferences.importModuleSpecifierEnding": "js",
}
diff --git a/ext/js/script/dynamic-loader-sentinel.js b/ext/js/script/dynamic-loader-sentinel.js
index 7f08c503..d549808e 100644
--- a/ext/js/script/dynamic-loader-sentinel.js
+++ b/ext/js/script/dynamic-loader-sentinel.js
@@ -18,4 +18,4 @@
import {yomichan} from '../yomichan.js';
-yomichan.trigger('dynamicLoaderSentinel', {script: document.currentScript});
+yomichan.trigger('dynamicLoaderSentinel', {script: import.meta.url});
diff --git a/ext/js/script/dynamic-loader.js b/ext/js/script/dynamic-loader.js
index 2eced077..ffce04c1 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; }
yomichan.off(sentinelEventName, sentinelEventCallback);
parent.removeChild(script);
resolve();