1. A concise explanation of the problem you’re experiencing.
I’m just trying the simple Getting Started guide but instead of getting the Cesium instance through the global scope of the injected js file in the public/index.html I want to get the same object trough the cesium npm package
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
So, I’,m trying this:
import { Cesium } from ‘cesium’;
// or even this without destructuring
import Cesium from ‘cesium’;
``
and I’m getting the same error on both cases:
Attempted import error: ‘Cesium’ is not exported from ‘cesium’
``
Otherwise, how can I get the same result that this does with the actual objects that cesium npm packages provides me
Cesium.Ion.defaultAccessToken = config.settings.map.cesiumIonKey;
this.CesiumViewer = new Cesium.Viewer(‘cesiumContainer’, Object.assign({}, CESIUM_OPTIONS, {
…this.props.options
}));
``
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I need this because I’m trying to embed the Cesium map on a ReactJS component like this:
class CtrlCesiumMap extends PureComponent {
componentDidMount() {
Cesium.Ion.defaultAccessToken = config.settings.map.cesiumIonKey;
this.CesiumViewer = new Cesium.Viewer(‘cesiumContainer’, Object.assign({}, CESIUM_OPTIONS, {
…this.props.options
}));
}
render() {
const { classes, id } = this.props;
return (
);
}
}
``
Furthermore, the code above totally works only if I add this to the public/index.html
``
4. The Cesium version you’re using, your operating system and browser.
Cesium npm package version: 1.63.1
OS: Windows 10
Browser: Google Chrome 78.0.3904.108