From 619bcc0f7347894c0750862d7628d5c2eaff3507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 23 Apr 2020 13:42:26 +0100 Subject: [PATCH] Use dynamicRequire to import 'module' --- source-map-support.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source-map-support.js b/source-map-support.js index 04180b4..4459386 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -536,12 +536,8 @@ exports.install = function(options) { // Support runtime transpilers that include inline source maps if (options.hookRequire && !isInBrowser()) { - var Module; - try { - Module = require('module'); - } catch (err) { - // NOP: Loading in catch block to convert webpack error to warning. - } + // Use dynamicRequire to avoid including in browser bundles + var Module = dynamicRequire(module, 'module'); var $compile = Module.prototype._compile; if (!$compile.__sourceMapSupport) {