|
8 | 8 | }
|
9 | 9 | </style>
|
10 | 10 | <style id="__sfc-styles"></style>
|
11 |
| - |
12 |
| - <!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) --> |
13 |
| - <script async src=" https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.min.js" ></script> |
14 |
| - <script id="map" type="importmap"><!--IMPORT_MAP--></script> |
15 |
| - |
16 | 11 | <script>
|
17 | 12 | (() => {
|
18 | 13 | let scriptEls = []
|
|
55 | 50 | scriptEl.setAttribute('type', 'module')
|
56 | 51 | // send ok in the module script to ensure sequential evaluation
|
57 | 52 | // of multiple proxy.eval() calls
|
58 |
| - const done = new Promise((resolve, reject) => { |
| 53 | + const done = new Promise((resolve) => { |
59 | 54 | window.__next__ = resolve
|
60 |
| - scriptEl.onerror = reject |
61 | 55 | })
|
62 | 56 | scriptEl.innerHTML = script + `\nwindow.__next__()`
|
63 | 57 | document.head.appendChild(scriptEl)
|
| 58 | + scriptEl.onrror = err => send_error(err.message, err.stack) |
64 | 59 | scriptEls.push(scriptEl)
|
65 | 60 | await done
|
66 | 61 | }
|
|
108 | 103 | window.addEventListener('message', handle_message, false);
|
109 | 104 |
|
110 | 105 | window.onerror = function (msg, url, lineNo, columnNo, error) {
|
111 |
| - parent.postMessage({ action: 'error', value: error }, '*'); |
| 106 | + if (msg.includes('module specifier “vue”')) { |
| 107 | + // firefox only error, ignore |
| 108 | + return false |
| 109 | + } |
| 110 | + try { |
| 111 | + parent.postMessage({ action: 'error', value: error }, '*'); |
| 112 | + } catch (e) { |
| 113 | + parent.postMessage({ action: 'error', value: msg }, '*'); |
| 114 | + } |
112 | 115 | }
|
113 | 116 |
|
114 | 117 | window.addEventListener("unhandledrejection", event => {
|
115 |
| - parent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*'); |
| 118 | + if (event.reason.message.includes('Cross-origin')) { |
| 119 | + event.preventDefault() |
| 120 | + return |
| 121 | + } |
| 122 | + try { |
| 123 | + parent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*'); |
| 124 | + } catch (e) { |
| 125 | + parent.postMessage({ action: 'unhandledrejection', value: event.reason.message }, '*'); |
| 126 | + } |
116 | 127 | });
|
117 | 128 |
|
118 | 129 | let previous = { level: null, args: null };
|
|
121 | 132 | const original = console[level];
|
122 | 133 | console[level] = (...args) => {
|
123 | 134 | const msg = String(args[0])
|
124 |
| - if (msg.includes('You are running a development build of Vue')) { |
| 135 | + if ( |
| 136 | + msg.includes('You are running a development build of Vue') || |
| 137 | + msg.includes('You are running the esm-bundler build of Vue') |
| 138 | + ) { |
125 | 139 | return
|
126 | 140 | }
|
127 | 141 | const stringifiedArgs = stringify(args);
|
|
137 | 151 | try {
|
138 | 152 | parent.postMessage({ action: 'console', level, args }, '*');
|
139 | 153 | } catch (err) {
|
140 |
| - parent.postMessage({ action: 'console', level: 'unclonable' }, '*'); |
| 154 | + parent.postMessage({ action: 'console', level, args: args.map(a => { |
| 155 | + return a instanceof Error ? a.message : String(a) |
| 156 | + }) }, '*'); |
141 | 157 | }
|
142 | 158 | }
|
143 | 159 |
|
|
232 | 248 | }
|
233 | 249 | })()
|
234 | 250 | </script>
|
| 251 | + |
| 252 | + <!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) --> |
| 253 | + <script async src=" https://unpkg.com/[email protected]/dist/es-module-shims.js" ></script> |
| 254 | + <script type="importmap"><!--IMPORT_MAP--></script> |
235 | 255 | </head>
|
236 | 256 | <body>
|
237 | 257 | <div id="app"></div>
|
|
0 commit comments