From ab7f97c011cd5ddb72b269d77dc05aeec21b2607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 11 Jul 2019 15:06:17 +0200 Subject: Fix "module.exports" no longer available in WebRTC adapter 7.2.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 7.2.5 the "main" property in the "package.json" of WebRTC adapter points to an ES6 file which does not provide "module.exports" but "exports.default". Due to this uses of "var adapter = require('webrtc-adapter');" now fail, as the properties of the module are loaded in "adapter.default" instead of in "adapter". To restore the previous and expected behaviour a Babel plugin is now used to also add "module.exports" if "exports.default" exists. As WebRTC adapter still provides an ES5 file an alternative solution would have been to alias "webrtc-adapter" to that file with '--transform [ aliasify --global --aliases [ --webrtc-adapter "webrtc-adapter/dist/adapter_core5.js" ] ]'. Signed-off-by: Daniel Calviño Sánchez --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 612707485..4d57891b2 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,10 @@ bundle-simplewebrtc: # webrtc-adapter uses JavaScript features not supported by browserify, # so the sources need to be transformed using babel to a compatible # version of JavaScript. - npx browserify --standalone SimpleWebRTC --transform [ babelify --global --presets [ @babel/env ] ] js/simplewebrtc/simplewebrtc.js > js/simplewebrtc/bundled.js + # Its main module does no longer provide "module.exports", which is + # expected by the code using it, so it needs to be added back with a + # plugin. + npx browserify --standalone SimpleWebRTC --transform [ babelify --global --presets [ @babel/env ] --plugins [ add-module-exports ] ] js/simplewebrtc/simplewebrtc.js > js/simplewebrtc/bundled.js create-tag: git tag -a v$(version) -m "Tagging the $(version) release." -- cgit v1.2.3