From 37632d84c817f158cb8316a5a0c494330c7dd9f7 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 9 Nov 2023 16:47:01 +0100 Subject: [PATCH] Eliminate worklet-loader --- package.json | 1 - webpack.config.js | 33 ++++++++++++--------------------- yarn.lock | 24 +----------------------- 3 files changed, 13 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 47c43d519e..eabfaf76aa 100644 --- a/package.json +++ b/package.json @@ -187,7 +187,6 @@ "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", "worker-loader": "^3.0.0", - "worklet-loader": "^2.0.0", "yaml": "^2.3.3" }, "@casualbot/jest-sonar-reporter": { diff --git a/webpack.config.js b/webpack.config.js index 4bd174f909..564713997d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -271,6 +271,18 @@ module.exports = (env, argv) => { // optimised, so there is little to gain by us uglifying it. /olm[\\/](javascript[\\/])?olm\.js$/, ], + parser: { + javascript: { + worker: [ + // Special syntax for loading audio worklets as documented in + // https://github.com/webpack/webpack.js.org/issues/6869. Note + // that this only works when using literal strings as argument + // in the addModule call. + "*context.audioWorklet.addModule()", + "*audioWorklet.addModule()", + ], + }, + }, rules: [ useHMR && { test: /devcss\.ts$/, @@ -463,27 +475,6 @@ module.exports = (env, argv) => { outputPath: ".", }, }, - { - // Special case the recorder worklet as it can't end up HMR'd, but the worker-loader - // isn't good enough for us. Note that the worklet-loader is listed as "do not use", - // however it seems to work fine for our purposes. - test: /RecorderWorklet\.ts$/, - type: "javascript/auto", - use: [ - // executed last -> first, for some reason. - { - loader: "worklet-loader", - options: { - // Override name so we know what it is in the output. - name: "recorder-worklet.[hash:7].js", - }, - }, - { - // TS -> JS because the worklet-loader won't do this for us. - loader: "babel-loader", - }, - ], - }, { // This is from the same place as the encoderWorker above, but only needed // for Safari support. diff --git a/yarn.lock b/yarn.lock index 451844b8c4..53d194e5f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6494,11 +6494,6 @@ highlight.js@^11.3.1: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.9.0.tgz#04ab9ee43b52a41a047432c8103e2158a1b8b5b0" integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw== -hoek@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" - integrity sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA== - hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" @@ -8111,7 +8106,7 @@ loader-runner@^4.2.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== -loader-utils@^1.0.0, loader-utils@^1.1.0: +loader-utils@^1.1.0: version "1.4.2" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3" integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg== @@ -10915,14 +10910,6 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -schema-utils@^0.4.0: - version "0.4.7" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" - integrity sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ== - dependencies: - ajv "^6.1.0" - ajv-keywords "^3.1.0" - schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" @@ -12713,15 +12700,6 @@ worker-loader@^3.0.0: loader-utils "^2.0.0" schema-utils "^3.0.0" -worklet-loader@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/worklet-loader/-/worklet-loader-2.0.0.tgz#c6c8f7dbed38f3d32dfc61c399f13a85f7eebe9d" - integrity sha512-zvCCyhgrn85C5g1+EQWDz4KHxkEMq/fZQXVftjFOcxTy6f+grBSRTJLoit3u8xyKIBTGEgQzYiousSm3YWt8oA== - dependencies: - hoek "^4.2.1" - loader-utils "^1.0.0" - schema-utils "^0.4.0" - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"