Skip to content

Commit

Permalink
Merge pull request #8560 from jimmyangel/master
Browse files Browse the repository at this point in the history
Fix require for Node.js (Fixes #8559)
  • Loading branch information
mramato authored Feb 26, 2020
2 parents c905d87 + b1582c1 commit 88f5da5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Tinco Andringa](https://github.com/tinco)
* [André Borud](https://github.com/andreborud)
* [Nathan Schulte](https://github.com/nmschulte)
* [Ricardo Morin](https://github.com/jimmyangel)
* [Jan Wąsak](https://github.com/jhnwsk)
* [Julian Fell](https://github.com/jtfell)
11 changes: 3 additions & 8 deletions Source/Core/Resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1899,15 +1899,10 @@ import TrustedServers from './TrustedServers.js';
}

function loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType) {

// Specifically use the Node version of require to avoid conflicts with the global
// require defined in the built version of Cesium.
var nodeRequire = global.require; // eslint-disable-line

// Note: only the 'json' and 'text' responseTypes transforms the loaded buffer
var URL = nodeRequire('url').parse(url);
var http = URL.protocol === 'https:' ? nodeRequire('https') : nodeRequire('http');
var zlib = nodeRequire('zlib');
var URL = require('url').parse(url); // eslint-disable-line
var http = URL.protocol === 'https:' ? require('https') : require('http'); // eslint-disable-line
var zlib = require('zlib'); // eslint-disable-line
var options = {
protocol : URL.protocol,
hostname : URL.hostname,
Expand Down

0 comments on commit 88f5da5

Please sign in to comment.