Skip to content
Snippets Groups Projects
Select Git revision
  • c0d14daa17efed6097bf7601953fda4136f5698e
  • renovate/all-minor-patch
  • langley/use_list_view_with_room_list_rebased
  • staging
  • develop
  • toger5/remove-NoOneHere-disabled-reason
  • andybalaam/hide-recovery-key-creation
  • langleyd/update_composer_encrpytion_icon
  • t3chguy/fix/29014
  • t3chguy/fix/30512
  • t3chguy/fix/30353
  • t3chguy/fix/30502
  • t3chguy/module-api-1.3.0
  • renovate/css
  • florianduros/storybook-pr
  • robin/call-cleanup
  • langley/use_list_view_with_room_list
  • renovate/jest
  • renovate/storybook-monorepo
  • renovate/eslint
  • t3chguy/oidc-cb-url-ec-universal-links
  • v1.11.109-rc.0
  • v1.11.108
  • v1.11.107
  • v1.11.107-rc.0
  • v1.11.106
  • v1.11.106-rc.0
  • v1.11.105
  • v1.11.105-rc.0
  • v1.11.104
  • v1.11.104-rc.0
  • v1.11.103
  • v1.11.102
  • v1.11.102-rc.0
  • v1.11.101
  • v1.11.101-rc.0
  • v1.11.100
  • v1.11.100-rc.0
  • v1.11.99
  • v1.11.98
  • v1.11.98-rc.0
41 results

recorder-worklet-loader.js

Blame
  • recorder-worklet-loader.js 1.11 KiB
    /*
    Copyright 2024 New Vector Ltd.
    Copyright 2023 The Matrix.org Foundation C.I.C.
    
    SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
    Please see LICENSE files in the repository root for full details.
    */
    
    // Inspired by https://github.com/reklawnos/worklet-loader which doesn't
    // formally support Webpack 5
    
    const SingleEntryPlugin = require("webpack/lib/SingleEntryPlugin");
    
    module.exports = function () {};
    
    module.exports.pitch = function pitch(request) {
        const cb = this.async();
        const filename = "recorder.worklet.js";
    
        const compiler = this._compilation.createChildCompiler("worker", {
            filename,
            chunkFilename: `[id].${filename}`,
            namedChunkFilename: null,
        });
    
        new SingleEntryPlugin(this.context, `!!${request}`, "main").apply(compiler);
    
        compiler.runAsChild((err, entries, compilation) => {
            if (err) {
                return cb(err);
            }
            if (entries[0]) {
                return cb(null, `module.exports = __webpack_public_path__ + ${JSON.stringify([...entries[0].files][0])};`);
            }
            return cb(null, null);
        });
    };