responseType 'image' is not supported in Web Workers or Node environment

01-19-2021 10:41 AM
Occasional Contributor II

I'm trying to create an Ionic-Angular application with a map on its main page, using ArcGIS ES Modules. I've used the code from to display the map. 

This works OK when I build and run the app in Android. When I try to build and run a desktop app using Electron, though, the code errors here:

if (t = h.url, "image" === (s = h.requestOptions).responseType) {
 if (Object(_core_has_js__WEBPACK_IMPORTED_MODULE_1__["default"])("host-webworker") || Object(_core_has_js__WEBPACK_IMPORTED_MODULE_1__["default"])("host-node"))
 throw M("request:invalid-parameters", new Error("responseType 'image' is not supported in Web Workers or Node environment"), h)

The code to get the map is in the only layer I know that will result in it showing up in the app UI, but it seems that somehow when trying to run it in an Electron window it's running in an unsupported environment.

What exactly is happening here and are there any ideas on how to resolve it?

0 Kudos
4 Replies
Frequent Contributor

It's been a while since I used electron, but I wouldn't think lots of it would work directly. I've used ipc with BrowserWindow for communication. The Electron build is registering as node env, so breaks DOM related checks. Do you have a sample repro electron project to test with?

0 Kudos
Occasional Contributor II

Thanks for the reply. I have tried but failed to create a pure Electron app that uses ArcGIS ES modules, because I can't seem to use ES modules in an Electron app. When I try to import them I get errors related to using import statements outside a module. I've tried to use Babel and other solutions I've found online, but no luck. The Ionic/Angular/Electron app, though, does at least run and tries to load the map.

That Ionic/Angular/Electron app referred to above is at The map is loaded in

To build and run it as a desktop app, use "ionic build && npx cap copy @capacitor-community/electron" and "npx cap open @capacitor-community/electron" respectively.

With the current "gray" basemap you'll see no map when the app loads (which takes several seconds, after which time you should see 2 blue buttons). If you change the basemap to "topo-vector" a map will appear, presumably because it is a vector map (at least partly).

0 Kudos
New Contributor

Do you have nodeIntegration enabled?

I'm encountering the same error message coming from my WMSLayer, but only when loaded through electron w/ nodeIntegration enabled (which is required for IPC).

I haven't found a solution yet.

0 Kudos
Occasional Contributor II

I tried to disable nodeIntegration in electron\src\index.ts with the following code:


const myCapacitorApp = createCapacitorElectronApp({
  mainWindow: {
    windowOptions: {
      webPreferences: {
        nodeIntegration: false


However, that had no effect on the errors and map behavior. Is there another way to do that?

In a comment at, there's a suggestion set configurations.production.sourceMaps to true in angular.json. I tried that, but it seemed to have no effect.

0 Kudos