From 0fdf6e995d4a36a2a62fd90a34eb0e5ab0e2e627 Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Sun, 23 Jul 2023 12:00:28 +0800 Subject: [PATCH] docs(commonjs): update docs --- 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(