Cesium + Webpack + Ts

1. A concise explanation of the problem you're experiencing.

I have tried to add typescript support to the offical Webpack repo of Cesium. (https://github.com/AnalyticalGraphicsInc/cesium-webpack-example)
I just can't get it to work with the ts definitions found here: https://libraries.io/npm/cesium-typings
It compiles just fine, but an error is produced in the browser: "ReferenceError: Cesium is not defined"
I don't know how to use the definitions.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

/// <reference path="typings.d.ts" />
require("cesium/Cesium")
require('cesium/Widgets/widgets.css');
// Example app
var viewer = new Cesium.Viewer('cesiumContainer');

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to use webpack with cesium and typescript.

4. The Cesium version you're using, your operating system and browser.

OS: Fedora 27
Browser: Firefox 57.0.1

Hi there,

Importing Cesium.js in webpack does not define the Cesium variable globally.

var Cesium = require(“cesium/Cesium”);

``

That should resolve your reference error, but may be incompatible with how you are including the .ts file. I don’t have experience adding it to webpack with Cesium, but there is a TypeScript loader available along with some useful documentation, which I would try. Let us know if you have any success! I’m sure others would like to use the same configuration.

Thanks,

Gabby