Using Cesium with Angular

I tried to use cesium in my angular project but i always get the same errors

ERROR in ./node_modules/cesium/Source/Core/Resource.js
Module not found: Error: Can’t resolve ‘http’ in ‘C:\CloudApp\CityGuide\node_modules\cesium\Source\Core’
ERROR in ./node_modules/cesium/Source/Core/Resource.js
Module not found: Error: Can’t resolve ‘https’ in ‘C:\CloudApp\CityGuide\node_modules\cesium\Source\Core’
ERROR in ./node_modules/cesium/Source/Core/Resource.js
Module not found: Error: Can’t resolve ‘zlib’ in ‘C:\CloudApp\CityGuide\node_modules\cesium\Source\Core’

@muhammedalilevent you need to provide a custom webpack configuration for this. Check out the following resources:

1 Like

thanks for the reply I’ll try and then let you know :slight_smile:

I’ve already tried this resources and I got nothing :frowning:

Could you please provide a reproduction in Stackblitz or GitHub to have a look?

I wish I could bu it’s my coorps. product so I am not permitted to share :frowning:
but still thanks for your interest

1 Like

@muhammedalilevent if you are now using Angular 12 that comes with Webpack 5 support, the approach with the extra webpack configuration file will not work. It needs to be modified as follows:

module.exports = {
  resolve: {
    fallback: {
      fs: "empty",
      Buffer: false,
      http: "empty",
      https: "empty",
      zlib: "empty"
    }
  },
  module: {
    unknownContextCritical: false
  }
};

I hope that helps :blush: