From 07329e2f72a27118a2bcfd3c1ecf25106a9304e8 Mon Sep 17 00:00:00 2001 From: XiaoPi <530257315@qq.com> Date: Sat, 12 Aug 2023 01:11:04 +0800 Subject: [PATCH] docs(commonjs): update docs (#1545) --- packages/commonjs/README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/commonjs/README.md b/packages/commonjs/README.md index f2803e530..3024b1e43 100644 --- a/packages/commonjs/README.md +++ b/packages/commonjs/README.md @@ -299,7 +299,18 @@ For these situations, you can change Rollup's behaviour either globally or per m import * as dep$1 from 'dep'; function getAugmentedNamespace(n) { - var a = Object.defineProperty({}, '__esModule', { value: true }); + if (n.__esModule) return n; + var f = n.default; + if (typeof f == 'function') { + var a = function a() { + if (this instanceof a) { + return Reflect.construct(f, arguments, this.constructor); + } + return f.apply(this, arguments); + }; + a.prototype = f.prototype; + } else a = {}; + Object.defineProperty(a, '__esModule', { value: true }); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(