美文网首页
编译js代码 Microsoft Corporation的MIT

编译js代码 Microsoft Corporation的MIT

作者: aaagu1234 | 来源:发表于2022-05-28 11:17 被阅读0次

为什么webpack 打包会有这个说明,是因为用到了微软的__assign函数,

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

方案一:编译target不用es5,用es6。

方案二:【推荐】不用 { ...obj } 语法浅拷贝,改用Object.assign({}, obj)浅拷贝(相对__assign效率还高些)
参考: https://blog.csdn.net/kd_2015/article/details/123220478

相关文章

网友评论

      本文标题:编译js代码 Microsoft Corporation的MIT

      本文链接:https://www.haomeiwen.com/subject/nasiprtx.html