微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

未捕获的TypeError:Parcel.js

如何解决未捕获的TypeError:Parcel.js

一段时间以来,我的Javascript代码运行良好,然后我尝试将所有内容与Parcel.js捆绑在一起,结果得到的文件看起来不错(对我来说!)

但是,当我尝试调用任何方法时,都失败了,例如以下调用

window.smartpixel.blazorcore.cookies.get('socloze.rollout')

返回错误

VM171:1 Uncaught TypeError

我签入了变量,并且在“手表”中看到了此方法,因此我不理解 这个问题的原因?

有人有类似的问题吗?

我加入生成文件,以供审核。

parcelRequire = function(e,r,t,n) {
    var i,o = "function" == typeof parcelRequire && parcelRequire,u = "function" == typeof require && require;

    function f(t,n) {
        if (!r[t]) {
            if (!e[t]) {
                var i = "function" == typeof parcelRequire && parcelRequire;
                if (!n && i) return i(t,!0);
                if (o) return o(t,!0);
                if (u && "string" == typeof t) return u(t);
                var c = new Error("Cannot find module '" + t + "'");
                throw c.code = "MODULE_NOT_FOUND",c
            }
            p.resolve = function(r) {
                return e[t][1][r] || r
            },p.cache = {};
            var l = r[t] = new f.Module(t);
            e[t][0].call(l.exports,p,l,l.exports,this)
        }
        return r[t].exports;

        function p(e) {
            return f(p.resolve(e))
        }
    }
    f.isParcelRequire = !0,f.Module = function(e) {
        this.id = e,this.bundle = f,this.exports = {}
    },f.modules = e,f.cache = r,f.parent = o,f.register = function(r,t) {
        e[r] = [function(e,r) {
            r.exports = t
        },{}]
    };
    for (var c = 0; c < t.length; c++) try {
        f(t[c])
    } catch (e) {
        i || (i = e)
    }
    if (t.length) {
        var l = f(t[t.length - 1]);
        "object" == typeof exports && "undefined" != typeof module ? module.exports = l : "function" == typeof define && define.amd ? define(function() {
            return l
        }) : n && (this[n] = l)
    }
    if (parcelRequire = f,i) throw i;
    return f
}({
    "CSbu": [function(require,module,exports) {
        window.smartpixel = window.smartpixel || {},window.smartpixel.blazorcore = window.smartpixel.blazorcore || {},window.smartpixel.blazorcore.cookies = window.smartpixel.blazorcore.cookies || {},window.smartpixel.blazorcore.bootstrap = window.smartpixel.blazorcore.bootstrap || {},window.smartpixel.blazorcore.jscode = window.smartpixel.blazorcore.jscode || new Map,window.smartpixel.blazorcore.jsuri = window.smartpixel.blazorcore.jsuri || new Map,window.smartpixel.blazorcore.evaluateJS = function(o) {
            try {
                Function('"use strict";' + o)()
            } catch (ex) {
                console.log(ex),alert(ex)
            }
        },window.smartpixel.blazorcore.dynamicLoadJavaScriptCode = function(o,e) {
            try {
                var t = document.createElement("script");
                t.type = "text/javascript",t.text = e,document.head.appendChild(t)
            } catch (n) {
                console.log(ex),alert(n)
            }
        },window.smartpixel.blazorcore.dynamicLoadJavaScriptUri = function(o,e) {
            try {
                var t = document.createElement("script");
                t.src = e,window.smartpixel.blazorcore.bootstrap.showModal = function(o) {
            $("#" + o).modal("show")
        },window.smartpixel.blazorcore.bootstrap.hideModal = function(o) {
            $("#" + o).modal("hide")
        },window.smartpixel.blazorcore.bootstrap.bindModal = function(o,e) {
            $("#" + o).on("hidden.bs.modal",function() {
                e.invokeMethodAsync("NotifyOnClose")
            })
        },window.smartpixel.blazorcore.bootstrap.modalFocus = function(o,e) {
            $("#" + o).on("shown.bs.modal",function() {
                $("#" + e).trigger("focus")
            })
        },$(document).ready(function() {
            $(document).on("show.bs.modal",".modal",function(o) {
                var e = 1040 + 10 * $(".modal:visible").length;
                $(this).css("z-index",e),setTimeout(function() {
                    $(".modal-backdrop").not(".modal-stack").css("z-index",e - 1).addClass("modal-stack")
                },0)
            })
        }),window.smartpixel.blazorcore.cookies.set = function(o,e,t) {
            o = encodeURIComponent(o),e = encodeURIComponent(e);
            var n = "";
            if (t > 0) {
                var r = new Date;
                r.setTime(r.getTime() + 24 * t * 60 * 60 * 1e3),n = ";expires=" + r.toUTCString()
            }
            document.cookie = o + "=" + e + n + ";Secure;path=/"
        },window.smartpixel.blazorcore.cookies.get = function(o) {
            for (var e = o + "=",t = decodeURIComponent(document.cookie).split(";"),n = 0; n < t.length; n++) {
                for (var r = t[n];
                    " " == r.charat(0);) r = r.substring(1);
                if (0 == r.indexOf(e)) return r.substring(e.length,r.length)
            }
            return ""
        },window.smartpixel.blazorcore.cookies.delete = function(o) {
            o = encodeURIComponent(o),document.cookie = o + "=; expires=Thu,01 Jan 1970 00:00:00 UTC; path=/;"
        },window.smartpixel.blazorcore.inputChipsEnter = function(o,e) {
            $("#" + o).keypress(function(t) {
                if (13 == (t.keyCode ? t.keyCode : t.which)) {
                    t.preventDefault();
                    var n = $("#" + o);
                    e.invokeMethodAsync("ParseTags",n.val()),n.val("")
                }
            }),$("#" + o).focusout(function(t) {
                var n = $("#" + o);
                e.invokeMethodAsync("ParseTags",n.val("")
            })
        };
    },{}],"D81n": [function(require,exports) {
        "use strict";
        var t = this && this.__awaiter || function(t,n,o) {
                return new(n || (n = Promise))(function(i,a) {
                    function r(t) {
                        try {
                            u(o.next(t))
                        } catch (e) {
                            a(e)
                        }
                    }

                    function c(t) {
                        try {
                            u(o.throw(t))
                        } catch (e) {
                            a(e)
                        }
                    }

                    function u(t) {
                        t.done ? i(t.value) : new n(function(e) {
                            e(t.value)
                        }).then(r,c)
                    }
                    u((o = o.apply(t,e || [])).next())
                })
            },e = this && this.__generator || function(t,e) {
                var n,o,i,a,r = {
                    label: 0,sent: function() {
                        if (1 & i[0]) throw i[1];
                        return i[1]
                    },trys: [],ops: []
                };
                return a = {
                    next: c(0),throw: c(1),return: c(2)
                },"function" == typeof Symbol && (a[Symbol.iterator] = function() {
                    return this
                }),a;

                function c(a) {
                    return function(c) {
                        return function(a) {
                            if (n) throw new TypeError("Generator is already executing.");
                            for (; r;) try {
                                if (n = 1,o && (i = 2 & a[0] ? o.return : a[0] ? o.throw || ((i = o.return) && i.call(o),0) : o.next) && !(i = i.call(o,a[1])).done) return i;
                                switch (o = 0,i && (a = [2 & a[0],i.value]),a[0]) {
                                    case 0:
                                    case 1:
                                        i = a;
                                        break;
                                    case 4:
                                        return r.labeL++,{
                                            value: a[1],done: !1
                                        };
                                    case 5:
                                        r.labeL++,o = a[1],a = [0];
                                        continue;
                                    case 7:
                                        a = r.ops.pop(),r.trys.pop();
                                        continue;
                                    default:
                                        if (!(i = (i = r.trys).length > 0 && i[i.length - 1]) && (6 === a[0] || 2 === a[0])) {
                                            r = 0;
                                            continue
                                        }
                                        if (3 === a[0] && (!i || a[1] > i[0] && a[1] < i[3])) {
                                            r.label = a[1];
                                            break
                                        }
                                        if (6 === a[0] && r.label < i[1]) {
                                            r.label = i[1],i = a;
                                            break
                                        }
                                        if (i && r.label < i[2]) {
                                            r.label = i[2],r.ops.push(a);
                                            break
                                        }
                                        i[2] && r.ops.pop(),r.trys.pop();
                                        continue
                                }
                                a = e.call(t,r)
                            } catch (c) {
                                a = [6,c],o = 0
                            } finally {
                                n = i = 0
                            }
                            if (5 & a[0]) throw a[1];
                            return {
                                value: a[0] ? a[1] : void 0,done: !0
                            }
                        }([a,c])
                    }
                }
            },n = function() {
                return function() {
                    this.latitude = 0,this.longitude = 0,this.accuracy = 0
                }
            }(),o = "SmartPixel.Core.Blazor";

        function i(n,i) {
            return t(this,void 0,function() {
                return e(this,function(t) {
                    switch (t.label) {
                        case 0:
                            return [4,DotNet.invokeMethodAsync(o,"ReceiveResponse",i.latitude,i.longitude,i.accuracy)];
                        case 1:
                            return t.sent(),[2]
                    }
                })
            })
        }

        function a(n,"ReceiveWatchResponse",[2]
                    }
                })
            })
        }

        function r(n,"ReceiveIsGrantedResponse",i)];
                        case 1:
                            return t.sent(),[2]
                    }
                })
            })
        }
        window.SmartPixel = window.SmartPixel || {},window.SmartPixel.Core = window.SmartPixel.Core || {},window.SmartPixel.Core.Blazor = window.SmartPixel.Core.Blazor || {},window.SmartPixel.Core.Blazor.IsGeolocationGranted = function(t) {
            return !!mobileNativeInvoke("RequestIsGeolocationGranted(" + t + ")") || (navigator.permissions ? (navigator.permissions.query({
                name: "geolocation"
            }).then(function(e) {
                var n = "granted" == e.state;
                r(t,n)
            }),!0) : !!navigator.geolocation && (navigator.geolocation.getCurrentPosition(function(e) {
                r(t,!0)
            },function(e) {
                var n = !1;
                1 == e.code && (n = !1),r(t,n)
            },{
                maximumAge: 3e4,timeout: 100,enableHighAccuracy: !1
            }),!0))
        },window.SmartPixel.Core.Blazor.GetLocation = function(t) {
            return !!mobileNativeInvoke("RequestGeolocation(" + t + ")") || !!navigator.geolocation && (navigator.geolocation.getAccurateCurrentPosition(function(e) {
                i(t,e.coords)
            },function() {
                i(t,{
                    latitude: 51.509865,longitude: -.118092,accuracy: 0
                })
            },function() {},{
                desiredAccuracy: 20,maxWait: 1e3
            }),!0)
        },window.SmartPixel.Core.Blazor.WatchGeolocation = function(t) {
            return !!navigator.geolocation && (navigator.geolocation.watchPosition(function(e) {
                a(t,e.coords)
            }),navigator.geolocation.getAccurateCurrentPosition = function(t,o) {
            var i,c = 0,u = function(e) {
                    t(e)
                };
            (o = o || {}).maxWait || (o.maxWait = 1e4),o.desiredAccuracy || (o.desiredAccuracy = 20),o.timeout || (o.timeout = o.maxWait),o.maximumAge = 0,o.enableHighAccuracy = !0,a = navigator.geolocation.watchPosition(function(t) {
                i = t,c += 1,t.coords.accuracy <= o.desiredAccuracy && c > 1 ? (clearTimeout(r),navigator.geolocation.clearWatch(a),u(t)) : n(t)
            },function(t) {
                clearTimeout(r),e(t)
            },o),r = setTimeout(function() {
                navigator.geolocation.clearWatch(a),u(i)
            },o.maxWait)
        };
    },"xiEM": [function(require,exports) {
        "use strict";

        function t(t,a) {
            if (!(t instanceof a)) throw new TypeError("Cannot call a class as a function")
        }

        function a(t) {
            if (t) return t[exports.matBlazorInstance]
        }

        function e(t,a) {
            if (t) return t[exports.matBlazorInstance] = a,a
        }
        Object.defineProperty(exports,"__esModule",{
            value: !0
        }),exports.MatBlazorComponent = exports.setMatBlazorInstance = exports.getMatBlazorInstance = exports.matBlazorInstance = void 0,exports.matBlazorInstance = "$matBlazorInstance",exports.getMatBlazorInstance = a,exports.setMatBlazorInstance = e;
        var n = function a(n) {
            t(this,a),this.ref = n,e(n,this)
        };
        exports.MatBlazorComponent = n;
    },"HUaJ": [function(require,exports) {
        "use strict";

        function e() {
            return window.innerWidth < 1e3
        }

        function i() {
            return window.innerWidth
        }
        Object.defineProperty(exports,exports.windowInnerWidth = exports.isMobile = void 0,exports.isMobile = e,exports.windowInnerWidth = i;
    },"VNd2": [function(require,exports) {
        "use strict";

        function e(t) {
            return (e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
                return typeof e
            } : function(e) {
                return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
            })(t)
        }

        function t(e,t) {
            if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
        }

        function r(e,t) {
            for (var r = 0; r < t.length; r++) {
                var n = t[r];
                n.enumerable = n.enumerable || !1,n.configurable = !0,"value" in n && (n.writable = !0),Object.defineProperty(e,n.key,n)
            }
        }

        function n(e,n) {
            return t && r(e.prototype,t),n && r(e,n),e
        }

        function o(e,t) {
            if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
            e.prototype = Object.create(t && t.prototype,{
                constructor: {
                    value: e,writable: !0,configurable: !0
                }
            }),t && i(e,t)
        }

        function i(e,t) {
            return (i = Object.setPrototypeOf || function(e,t) {
                return e.__proto__ = t,e
            })(e,t)
        }

        function u(e) {
            var t = c();
            return function() {
                var r,n = s(e);
                if (t) {
                    var o = s(this).constructor;
                    r = Reflect.construct(n,arguments,o)
                } else r = n.apply(this,arguments);
                return a(this,r)
            }
        }

        function a(t,r) {
            return !r || "object" !== e(r) && "function" != typeof r ? f(t) : r
        }

        function f(e) {
            if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
            return e
        }

        function c() {
            if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
            if (Reflect.construct.sham) return !1;
            if ("function" == typeof Proxy) return !0;
            try {
                return Date.prototype.toString.call(Reflect.construct(Date,[],function() {})),!0
            } catch (e) {
                return !1
            }
        }

        function s(e) {
            return (s = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
                return e.__proto__ || Object.getPrototypeOf(e)
            })(e)
        }
        var l = this && this.__awaiter || function(e,n) {
            return new(r || (r = Promise))(function(o,i) {
                function u(e) {
                    try {
                        f(n.next(e))
                    } catch (t) {
                        i(t)
                    }
                }

                function a(e) {
                    try {
                        f(n.throw(e))
                    } catch (t) {
                        i(t)
                    }
                }

                function f(e) {
                    var t;
                    e.done ? o(e.value) : (t = e.value,t instanceof r ? t : new r(function(e) {
                        e(t)
                    })).then(u,a)
                }
                f((n = n.apply(e,t || [])).next())
            })
        };
        Object.defineProperty(exports,exports.readAsArrayBufferAsync = exports.readDataAsync = exports.init = exports.MatFileUpload = void 0,require("../utils/base");
        var p = require("../utils/base"),y = function(e) {
                o(i,p.MatBlazorComponent);
                var r = u(i);

                function i(e,o) {
                    var u;
                    return t(this,i),(u = r.call(this,e)).inputRef = n,u.componentRef = o,u.files = [],u.inputRef.addEventListener("change",function(e) {
                        var t = Array.from(u.inputRef.files).map(function(e) {
                            var t = {
                                id: u.files.length,lastModified: new Date(e.lastModified),name: e.name,size: e.size,type: e.type
                            };
                            return u.files.push({
                                info: t,file: e
                            }),t
                        });
                        u.componentRef.invokeMethodAsync("NotifyChange",t).then(null,function(e) {
                            throw new Error(e)
                        })
                    }),u
                }
                return n(i,[{
                    key: "readDataAsArrayBufferAsync",value: function(e) {
                        return e.arrayBufferPromise || (e.arrayBufferPromise = d(e.file)),e.arrayBufferPromise
                    }
                },{
                    key: "readDataAsync",value: function(e,r) {
                        return l(this,regeneratorRuntime.mark(function n() {
                            var o,u,a;
                            return regeneratorRuntime.wrap(function(n) {
                                for (;;) switch (n.prev = n.next) {
                                    case 0:
                                        return o = this.files[e],n.next = 3,this.readDataAsArrayBufferAsync(o);
                                    case 3:
                                        return i = n.sent,u = new Uint8Array(i,Math.min(r,i.byteLength - t)),a = m()(u),n.abrupt("return",a);
                                    case 7:
                                    case "end":
                                        return n.stop()
                                }
                            },this)
                        }))
                    }
                }]),i
            }();

        function h(e,r) {
            new y(e,r)
        }

        function v(e,n) {
            return l(this,regeneratorRuntime.mark(function o() {
                var i,u;
                return regeneratorRuntime.wrap(function(o) {
                    for (;;) switch (o.prev = o.next) {
                        case 0:
                            return o.prev = 0,i = p.getMatBlazorInstance(e),o.next = 4,i.readDataAsync(t,n);
                        case 4:
                            return u = o.sent,o.abrupt("return",u);
                        case 8:
                            throw o.prev = 8,o.t0 = o.catch(0),o.t0;
                        case 11:
                        case "end":
                            return o.stop()
                    }
                },null,[
                    [0,8]
                ])
            }))
        }

        function d(e) {
            return new Promise(function(t,r) {
                var n = new FileReader;
                n.onload = function() {
                    t(n.result)
                },n.onerror = function(e) {
                    r(e)
                },n.readAsArrayBuffer(e)
            })
        }
        exports.MatFileUpload = y,exports.init = h,exports.readDataAsync = v,exports.readAsArrayBufferAsync = d;
        var m = function() {
            for (var e = [],t = "ABCDEFGHIJKLMnopQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r = 0,n = t.length; r < n; ++r) e[r] = t[r];

            function o(t,n) {
                for (var o,u = [],a = r; a < n; a += 3) o = (t[a] << 16 & 16711680) + (t[a + 1] << 8 & 65280) + (255 & t[a + 2]),u.push(e[(i = o) >> 18 & 63] + e[i >> 12 & 63] + e[i >> 6 & 63] + e[63 & i]);
                return u.join("")
            }
            return function(t) {
                for (var r,n = t.length,i = n % 3,a = 0,f = n - i; a < f; a += 16383) u.push(o(t,a + 16383 > f ? f : a + 16383));
                return 1 === i ? (r = t[n - 1],u.push(e[r >> 2] + e[r << 4 & 63] + "==")) : 2 === i && (r = (t[n - 2] << 8) + t[n - 1],u.push(e[r >> 10] + e[r >> 4 & 63] + e[r << 2 & 63] + "=")),u.join("")
            }
        };
    },{
        "../utils/base": "xiEM"
    }],"VdTz": [function(require,exports) {

    },"IJVq": [function(require,exports) {
        "use strict";
        require("./js/soclozeBlazor.js"),require("./js/soclozeBlazorGeolocation.js"),require("./js/utils/base.js"),require("./js/utils/utils.js"),require("./js/UIFileUpload/MatFileUpload.js"),require("./css/soclozeBlazor.css");
    },{
        "./js/soclozeBlazor.js": "CSbu","./js/soclozeBlazorGeolocation.js": "D81n","./js/utils/base.js": "xiEM","./js/utils/utils.js": "HUaJ","./js/UIFileUpload/MatFileUpload.js": "VNd2","./css/soclozeBlazor.css": "VdTz"
    }]
},{},["IJVq"],null)
//# sourceMappingURL=/blazorcore.js.map

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。