Closed
Description
OS?
Windows 10
Versions.
angular-cli: 1.0.0-beta.17
node: 6.3.1
os: win32 x64
Repro steps.
I've tried to setup a 3rd party library (cesiumjs). There are many errors during the "serve" process.
- npm install cesium --save
- In angular-cli.json file:
"styles": [ "styles.css", "../node_modules/cesium/Build/Cesium/Widgets/widgets.css" ], "scripts": [ "../node_modules/cesium/Build/Cesium/Cesium.js" ],
- Created a simple component:
ng g component cesium-component- Inside the component used the Cesium global that's supposed to be available:
constructor(public element: ElementRef) { Cesium.BingMapsApi.defaultKey = 'AroazdWsTmTcIx4ZE3SIicDXX00yEp9vuRZyn6pagjyjgS-VdRBfBNAVkvrucbqr'; window.CESIUM_BASE_URL = '/assets'; }
ngOnInit() {
this.viewer = new Cesium.Viewer(this.element.nativeElement);
}
5) There are errors during the `ng serve` process (see the errors section).
6) The app does load, and Ceisum gives an error it cannot find files.
7) I copy Cesium into the app's assets dir, and set: `window.CESIUM_BASE_URL = '/assets/Cesium';` (as in the code example above)
8) I get errors during the `serve` process (see below).
### The log given by the failure.
> '''
ERROR in [default] D:\development\edu\ngCli\my_first_cli_project\src\app\cesium-component\cesium-component.component.ts:11:4
Cannot find name 'Cesium'.
ERROR in [default] D:\development\edu\ngCli\my_first_cli_project\src\app\cesium-component\cesium-component.component.ts:12:11
Property 'CESIUM_BASE_URL' does not exist on type 'Window'.
ERROR in [default] D:\development\edu\ngCli\my_first_cli_project\src\app\cesium-component\cesium-component.component.ts:16:9
Property 'viewer' does not exist on type 'CesiumComponentComponent'.
ERROR in [default] D:\development\edu\ngCli\my_first_cli_project\src\app\cesium-component\cesium-component.component.ts:16:22
Cannot find name 'Cesium'.
'''
### Mention any other details that might be useful.
My main question is:
Is there a way to connect the Cesium assets without copying them to the app itself? (make the app get them from node modules?) What would be best practice here?
Another small thing - why do the errors appear during the `serve` phase, while the app itself seems to be working correctly (I can see Cesium and it's running properly in my component).
> ---------------------------------------------------------------
Thanks