1. A concise explanation of the problem you're experiencing.
I have followed many online guides in an attempt to get Cesium to work in a web application built on Angular 7 + Java Spring (e.g. https://www.npmjs.com/package/angular-cesium). But in my browser console, I get the following error:
Uncaught ReferenceError: Cesium is not defined
at eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:464)
at Object.eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:468)
at __webpack_require__ (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:25)
at Object.eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:106)
at __webpack_require__ (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:25)
at Object.eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:555)
at __webpack_require__ (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:25)
at eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:69)
at eval (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:72)
at webpackUniversalModuleDefinition (webpack-internal:///./node_modules/primitive-primitives/dist/main.js:3)
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
The typeRoots array in my tsconfig includes "src/typings.d.ts", which includes "declare var Cesium;", but in my app.main.ts, Cesium is undefined here:
Cesium.buildModuleUrl.setBaseUrl('/assets/cesium/');
Even though WebStorm can navigate with a command+click between app.main.ts and src/typings.d.ts, so I know there is no typo. For reference, my app.module.ts includes:
import { AngularCesiumModule } from 'angular-cesium';
and the following in the provided array:
AngularCesiumModule.forRoot()
I have confirmed that I've run `npm install --save angular-cesium` and `npm install --save cesium`. I've updated angular.json with the assets, styles, and scripts arrays, though the syntax post-angular-cli.json is new:
"architect": {
"build": {
"options": {
"assets": [
{
"glob": "**/*",
"input": "./node_modules/cesium/Build/Cesium",
"output": "./assets/cesium"
}
],
"styles": [
"./node_modules/cesium/Build/Cesium/Widgets/widgets.css"
],
"scripts": [
"./node_modules/cesium/Build/Cesium/Cesium.js"
]
}
}
}
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I need to put bar graphs on a globe.
4. The Cesium version you're using, your operating system and browser.
cesium: "^1.59.0",
angular-cesium: "0.0.56",
angular 7.2.12
The application is deployed locally (Mac, sometimes Dockerized environment with Linux) and to Heroku and AWS. The environment doesn't affect the bug.