3
votes

When using my Electron app on Windows (problem doesn't appear on Mac) I started getting this error for some external URLs that are loaded into a <webview> tag: Uncaught SyntaxError: Unexpected token ... (which I believe refers to spread syntax).

It's hard for me to see a solution because of the fact it's an external URL. https://instagram.com is an example of as site that produces this error in my console.

This is my webview

<webview src="https://www.instagram.com/" preload="./custom_scripts/preload-manager.js" allowpopups="" webpreferences="webSecurity=no" partition="persist:default"></webview>

Using the Instagram example, this is the script that is throwing the error: https://www.instagram.com/static/bundles/es6/ConsumerCommons.js/c86cd1388003.js.

Here is a snippet of that script that contains the position of the error

const {
  allowStale: c,
  onCached: v
} = {
  allowStale: !1,
  ...s
}, p = l[o];
1
I'm not seeing this. What version of Windows and Electron are you using? And you're seeing this error in the devtools of the webview? Does the page load at all? - pushkin

1 Answers

0
votes

I encounted same problem. Enter the devtool of the external page and disable the cache in the network panel. It works. But I don't know why and how to get rid of this.