Export 'default' (imported as 'tt') was not found in '@tomtom-international/web-sdk-services

I get the following error when I try to use
@tomtom-international/web-sdk-services (5.60.0)
in my angular 9 project
I use
import tt from ‘@tomtom-international/web-sdk-services’;
key: ‘mykey’,
query: ‘Amsterdam, The Netherlands’,
and at the compiler I get the following error
export ‘default’ (imported as ‘tt’) was not found in '@tomtom-international/web-sdk-services

I’ve just tried to use Geocoding with Angular and it worked…

Can show some more of your code?

1 Like

I had a project that is running fine. I created 3 new empty projects to test it with angular 8, 9, 10 and it is working fine.
I am trying to adopt it in another project that is quite big and it fails with this error. I tried also 2-3 past versions and the beta version and it is still doing it. The problem is that the project that I am adding it is quite big to start it over… it is a one year work.
In case it helps when I use
const tt = require(’@tomtom-international/web-sdk-services’);
it compiles but then the tt.services is undefined to use it
So it sounds like there is a parameter or a conflict that is causing it. I hope that I can fix it else if I quit tomtom I would have to remove it from my other project too that I am using it in production!
Thank you in advance

Are you also using maps in this project or only the services lib?

only the services like my other project.
I use open layer maps for displaying maps and tomtom for geocoding.
I also have the same open layer maps plugin to my other project that is working fine. I also installed it in the test projects that I mentioned and it was still working fine with tomtom

can you try with the full path?

import tt from 'node_modules/@tomtom-international/web-sdk-services';

"export ‘default’ (imported as ‘tt’) was not found in ‘node_modules/@tomtom-international/web-sdk-services’

1 Like

Can you check if the file services.min.js exists and has any content? Or maybe try to compare it with a copy from other app.

yes it has content. I have also tried to overwrite all tomtom files from my working project but it still didn’t work. Although I had noticed differences in the directory structure in case it helps
working project has in node_modules
@tomtom-international\web-sdk-services\node_modules the following folders
core-js, regenerator-runtime, whatwg-fetch

the non working project has the following folders
core-js, lodash, regenerator-runtime

Does putting tt in curly brackets change anything?

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

or other guess from the team

import * as tt from '@tomtom-international/web-sdk-services'

I just tried both but neither one worked

Hi! Have you been able to do it?

I have a similar problem

ERROR TypeError: _tomtom_international_web_sdk_maps__WEBPACK_IMPORTED_MODULE_1___default.a.services is undefined

Hello ,Reading the all the reply. i found the solution.

  1. first of all the node_modules directory name was changes in latest version ( “@tomtom-international/web-sdk-maps”: “^6.12.0”) you can check in angular.json ( web-sdk-services to web-sdk-maps).
  2. So you can import the statement like this.

import tt from ‘@tomtom-international/web-sdk-maps’;

  1. so its getting error like allowSyntheticDefaultImports to flag similar like.

  2. so you can add “allowSyntheticDefaultImports” :true in tsconfing.json file inside the compilerOptions object

Happy Coding… :blush: