diff options
author | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-12 02:11:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-12 02:11:14 +0000 |
commit | f263e994c6eca2438eaff79cb22f1b48fe14b7b2 (patch) | |
tree | d6ada1c77732dd16a4c5a723cc432527583e5a7e /ext/js | |
parent | 382f2ec40ac6861adc90da253df0537d47c3e7cf (diff) | |
parent | 99a4b379565547ac624d0905dce1a5b802c2f9e4 (diff) |
Merge pull request #315 from jbukl/dynamic-loader-modules
Dynamic loader, Dexie ESM fix
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/pages/settings/backup-controller.js | 2 | ||||
-rw-r--r-- | ext/js/script/dynamic-loader-sentinel.js | 2 | ||||
-rw-r--r-- | ext/js/script/dynamic-loader.js | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js index e429f9c7..115b7581 100644 --- a/ext/js/pages/settings/backup-controller.js +++ b/ext/js/pages/settings/backup-controller.js @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import * as Dexie from '../../../lib/dexie.js'; +import {Dexie} from '../../../lib/dexie.js'; import {isObject, log} from '../../core.js'; import {OptionsUtil} from '../../data/options-util.js'; import {ArrayBufferUtil} from '../../data/sandbox/array-buffer-util.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(); |