Webpack not bundling cesium properly

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

Hello, so I’m currently using webpack to bundle cesium and I am getting the following error after I build and deploy: Uncaught SyntaxError: Unexpected token ‘export’

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

My package.json:

My webpack.config.js:

My .babelrc:

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

I am trying to build and deploy my web app.

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

I am working on a CentOS server, google chrome, and cesium version: 1.62.0

I think I found the answer. Previous environment was using 1.62 while current environment was on 1.63. Any thoughts on why version 1.63 was not bundling correctly?

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

Hello, so I’m currently using webpack to bundle cesium and I am getting the following error after I build and deploy: Uncaught SyntaxError: Unexpected token ‘export’

Previous environment:

current environment:

I think you’ll need to tweak your Webpack config to treat CesiumJS as ES6 modules. This was the big change with 1.63, see: https://cesium.com/blog/2019/10/31/cesiumjs-es6/

We updated the cesium-webpack example to account for this: https://github.com/AnalyticalGraphicsInc/cesium-webpack-example

Here’s the PR that did the ES6 update: https://github.com/AnalyticalGraphicsInc/cesium-webpack-example/pull/13

Let me know if that helps.