Skip to content
Snippets Groups Projects
Select Git revision
  • 2c50153618cbbf227704a274cfc46e0ec071b525
  • master default
  • feat/info-xml-backends
  • fix/shareapi-l10n
  • fix/missing-RemoteException-class
  • backport/46504/stable28
  • backport/46504/stable29
  • automated/noid/stable29-update-psalm-baseline
  • automated/noid/stable28-update-psalm-baseline
  • feat/46438/provide-feedback-edit-locally
  • fix-getimagesize
  • stable27
  • stable28
  • stable29
  • query-builder-connection
  • feature/request-803
  • autosharding
  • fix/noid/test-samba-with-self-hosted
  • fix/bring-back-forbidden-names
  • fix/htaccess
  • fix/use-filename-validator
  • v28.0.8rc1
  • v29.0.4rc1
  • v27.1.11
  • v28.0.7
  • v29.0.3
  • v28.0.7rc4
  • v29.0.3rc4
  • v29.0.3rc3
  • v28.0.7rc3
  • v27.1.11rc3
  • v27.1.11rc2
  • v28.0.7rc2
  • v29.0.3rc2
  • v27.1.11rc1
  • v28.0.7rc1
  • v29.0.3rc1
  • v29.0.2
  • v27.1.10
  • v29.0.2rc2
  • v29.0.2rc1
41 results

webpack.modules.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);
        });
    };