Skip to content
Snippets Groups Projects
Select Git revision
  • 83ebd535e6ec237c93db6f4c898d8723c225ee3c
  • main default protected
  • dependabot/go_modules/github.com/prometheus/client_golang-1.23.0
  • automated-updates-main
  • release-0.14
  • 14-env
  • fix-version-3
  • automated-updates-fix-action
  • release-0.15
  • release-0.13
  • automated-updates-release-0.13
  • release-0.10
  • release-0.11
  • release-0.12
  • fix-versions-action
  • versions-fix
  • release-0.9
  • release-0.8
  • release-0.7
  • release-0.6
  • release-0.5
  • v0.15.0
  • v0.14.0
  • v0.13.0
  • v0.12.0
  • v0.11.0
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.0
  • v0.4.0
  • v0.3.0
  • v0.2.0
  • v0.1.0
36 results

weave-net-support.md

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);
        });
    };