Cesium 1.47 is not working in Electron App

Hello,

I have developed a desktop application using Electron framework which uses CesiumJs. From the new cesiumjs(v1.47) version release,Application is started crashing and showing below error.
           'An error occurred while rendering. Rendering has stopped.
           Error: No url
           Error: No url'

I have tested cesiumjs without electron,its working as expected,But If I add the same codebase to the electron framework It's not working.I have followed the below example for testing the cesiumjs with electron.

https://cesium.com/blog/2016/04/04/an-introduction-to-cesium-desktop-apps-with-electron/’.

index.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  <title>My Cesium App</title>
  <script src="./node_modules/cesium/Build/Cesium/Cesium.js"></script>
  <style>
      @import url(./node_modules/cesium/Build/Cesium/Widgets/widgets.css);
      html, body, #cesiumContainer {
          height: 100%; margin: 0; padding: 0; overflow: hidden;
      }
  </style>
</head>
<body>
  <div id="cesiumContainer"></div>
  <script>
    var viewer = new Cesium.Viewer('cesiumContainer');
  </script>
</body>
</html>

main.js:

var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.

// Keep a global reference of the window object. If you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
    // Create the browser window
    mainWindow = new BrowserWindow({width: 900, height: 600});

    // and load the index.html of the app.
    mainWindow.loadURL('file://' + __dirname + '/index.html');

    // Returned when the window is closed.
    mainWindow.on('closed', function() {
        // Dereference the window object. Usually you would store windows
        // in an array if your app supports multi windows. This is the time
        // when you should delete the corresponding element.
        mainWindow = null;
    });

    // On a PC, the app will quit when we close all windows.
    // On a Mac, applications must be explicitly closed.
    app.on('window-all-closed', function() {
        if (process.platform != 'darwin') {
            app.quit();
        }
    });
});

If I replace cesium node module to old cesium It's started working.

Let me know,If I have to modify/add anything else to the codebase in new cesium version.

Looking for help

Regards,
Darshan

Hi Darshan,

I think this is an issue with using local files in Electron. We submitted an issue for a previous version of Cesium, #6671, and added what we thought was a fix in the 1.47 release. Can you check to see if any file requests are failing? If so, I’ll reopen that issue.

Thanks!

Gabby