Error after upgrading to Cesium 1.107.2 => GLTF loader error

Following upgrade to Cesium 1.107.2 (from 1.94.0) i am getting the following compiler error:

ERROR in ./node_modules/@cesium/engine/Source/Scene/GltfLoader.js 1026:57
Module parse failed: Unexpected token (1026:57)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack
| // However, for KHR_mesh_quantization, min and max must be dequantized for
| // normalized values, else the bounding sphere will be computed incorrectly.

const hasKhrMeshQuantization = gltf.extensionsRequired?.includes(
| “KHR_mesh_quantization”
| );

Is there a specific loader that should be added to fix this error?

Thanks in advance.

Hi there,

I assume you are using Webpack 4? Optional chaining, (the ?. syntax), isn’t be supported by Webpack 4 alone.

You can:

  1. Upgrade to Webpack 5, or
  2. Use use Babel (@babel/plugin-proposal-optional-chaining) or TypeScript compiler (target at most ES2019) for optional chaining transpilation.
1 Like

Hi,
I encountered the same problem as you, have you solved it?

May I ask if your problem has been resolved?

May I ask if your problem has been resolved? I also encountered this problem.