diff --git a/components/mjs/a11y/speech/speech.js b/components/mjs/a11y/speech/speech.js index d17ba6d74..a4c474b4d 100644 --- a/components/mjs/a11y/speech/speech.js +++ b/components/mjs/a11y/speech/speech.js @@ -14,7 +14,7 @@ if (MathJax.loader) { } else { const REQUIRE = typeof require !== 'undefined' ? require : MathJax.config.loader.require; if (REQUIRE?.resolve) { - path = REQUIRE.resolve(`${path}/package.json`).replace(/\/[^\/]*$/, ''); + path = REQUIRE.resolve(`${path}/require.mjs`).replace(/\/[^\/]*$/, ''); maps = REQUIRE.resolve(`${maps}/base.json`).replace(/\/[^\/]*$/, ''); } else { path = maps = ''; diff --git a/components/mjs/a11y/sre/worker/config.json b/components/mjs/a11y/sre/worker/config.json index cc2247763..c1303a29f 100644 --- a/components/mjs/a11y/sre/worker/config.json +++ b/components/mjs/a11y/sre/worker/config.json @@ -6,7 +6,6 @@ "to": "../../../../../bundle/sre", "from": "../../../../../ts/a11y/sre", "copy": [ - "package.json", "require.mjs", "require.d.mts" ] diff --git a/components/mjs/a11y/sre/worker/webpack.cjs b/components/mjs/a11y/sre/worker/webpack.cjs index 29b5bc4de..43ef657fa 100644 --- a/components/mjs/a11y/sre/worker/webpack.cjs +++ b/components/mjs/a11y/sre/worker/webpack.cjs @@ -1,8 +1,6 @@ const webpack = require('webpack'); module.exports = (pkg) => { - pkg.experiments = {outputModule: true}; - pkg.output.library = {type: 'module'}; pkg.plugins.push( new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1, diff --git a/ts/a11y/sre/package.json b/ts/a11y/sre/package.json deleted file mode 100644 index 3dbc1ca59..000000000 --- a/ts/a11y/sre/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/ts/a11y/sre/speech-worker.ts b/ts/a11y/sre/speech-worker.ts index ac2da3fed..3dd12a20a 100644 --- a/ts/a11y/sre/speech-worker.ts +++ b/ts/a11y/sre/speech-worker.ts @@ -110,11 +110,11 @@ declare const SRE: any; // // Load SRE // - await import('./sre.js') - .catch((_) => import(/* webpackIgnore: true */ './sre-lab.js')) // for use in the lab - .then((SRE) => { - global.SRE = SRE; - }); + await ( + global.isLab + ? import(/* webpackIgnore: true */ './sre-lab.js') // for use in the lab + : import('./sre.js') + ).then((SRE) => (global.SRE = SRE)); /*****************************************************************/ diff --git a/ts/adaptors/HTMLAdaptor.ts b/ts/adaptors/HTMLAdaptor.ts index 1e48c5344..c1a9d68dc 100644 --- a/ts/adaptors/HTMLAdaptor.ts +++ b/ts/adaptors/HTMLAdaptor.ts @@ -627,12 +627,12 @@ export class HTMLAdaptor< const file = `${path}/${worker}`; const content = ` self.maps = '${quoted(maps)}'; - import('${quoted(file)}'); + importScripts('${quoted(file)}'); `; const url = URL.createObjectURL( new Blob([content], { type: 'text/javascript' }) ); - const webworker = new Worker(url, { type: 'module' }); + const webworker = new Worker(url); webworker.onmessage = listener; URL.revokeObjectURL(url); return webworker;