Hello,
I’m trying to set up Cesium via craco and webpack. I followed the steps as per craco and cesium documentations. I’m using webpack v5.88.2, cesium v1.108.0 and craco v6.4.5. I tried with both npm and yarn. I see the following errors,
ERROR in ./node_modules/@cesium/engine/Source/Core/Resource.js 1864:15-28
Module not found: Error: Can't resolve 'url' in '/Users/Indhuja/Documents/flight-tracker-craco/node_modules/@cesium/engine/Source/Core'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
ERROR in ./node_modules/@cesium/engine/Source/Core/Resource.js 1864:30-44
Module not found: Error: Can't resolve 'zlib' in '/Users/Indhuja/Documents/flight-tracker-craco/node_modules/@cesium/engine/Source/Core'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "zlib": false }
ERROR in ./node_modules/@cesium/engine/Source/Core/Resource.js 1867:39-54
Module not found: Error: Can't resolve 'https' in '/Users/Indhuja/Documents/flight-tracker-craco/node_modules/@cesium/engine/Source/Core'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/@cesium/engine/Source/Core/Resource.js 1867:57-71
Module not found: Error: Can't resolve 'http' in '/Users/Indhuja/Documents/flight-tracker-craco/node_modules/@cesium/engine/Source/Core'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
On github, I found that this can be resolved with
resolve: {
fallback: { "https": false, "zlib": false, "http": false, "url": false },
mainFiles: ['index', 'Cesium']
},
in craco.config.js but still seeing the same error. Can someone please help me with this?