forked from CesiumGS/cesium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (31 loc) · 883 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*eslint-env node,es6*/
'use strict';
var path = require('path');
var requirejs = require('requirejs');
//In explicit development mode, use un-optimized requirejs modules for improved error checking.
if (process.env.NODE_ENV === 'development') {
requirejs.config({
paths: {
'Cesium': path.join(__dirname, 'Source')
},
nodeRequire: require
});
module.exports = requirejs('Cesium/Cesium');
return;
}
//In all other cases, use minified Cesium for performance.
requirejs.config({
paths: {
'Cesium': path.join(__dirname, 'Build/Cesium/Cesium')
},
nodeRequire: require
});
const hadCesiumProperty = global.hasOwnProperty('Cesium');
const oldCesium = global.Cesium;
requirejs('Cesium');
module.exports = global.Cesium;
if (hadCesiumProperty) {
global.Cesium = oldCesium;
} else {
delete global.Cesium;
}