@tomtom-international/web-sdk-services webpack nestJs

Hi I’m trying to setup my workspace with nx, nestjs, typescript and webpack
When importing services like the following

import { services } from '@tomtom-international/web-sdk-services';

I’m getting the following error:

\node_modules\@tomtom-international\web-sdk-services\dist\webpack:\webpack\universalModuleDefinition:10
})(self, function() {
   ^
ReferenceError: self is not defined
    at Object.<anonymous> (...\node_modules\@tomtom-international\web-sdk-services\dist\webpack:\webpack\universalModuleDefinition:10:4)

could you please advice

We have no experience with that setup.
Have you tried to set output.globalObject to this?

yes and doesn’t solve it
For nodejs + typescript

After configuring correctly webpack.
detected there is a problem with tomtom lib
main import is trying to access browser apis, like window etc

Managed to workaround it with

import { services } from ‘@tomtom-international/web-sdk-services/dist/services-node.min.js’;

but loosing typing capabilities

1 Like