Nx Angular microfrontend Build Error: "Module not found: Error: Can't resolve 'http' in..."

91 views Asked by At

i'm trying to add Cesium to my microfrontend Project with module federation implementation. I've Installed cesium (not angular-cesium) but when i try to do npx nx serve shell --devRemotes=map,admin i get the following errors:

Module not found: Error: Can't resolve 'zlib' in '..\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 }

and

Error: Module not found: Error: Can't resolve 'https' in '..\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 }

and

Error: Module not found: Error: Can't resolve 'http' in '..\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 }

I tried to solve it with this solutions:

cesium Comunity git from Cesium git from Cesium

but any of these worked for me.

this is the stackblitz for the project: stackblitz

Does anyone know what i`m doing wrong?

Thanks in advance!

0

There are 0 answers