Trying to build a TypeScript project using Webpack5 throws an error:
Compiled with problems:
WARNING in ./node_modules/universal-geocoder/dist/esm/utils.js 74:10-17
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Switching to CJS does not help - it fires same error for the cjs/utils.js
import UniversalGeocoder from 'universal-geocoder';
const geocoder = UniversalGeocoder.createGeocoder({
provider: 'googlemaps',
apiKey: 'KEY',
useSsl: true,
useJsonp: false
});
geocoder.geocode({
text: '1600 Pennsylvania Ave, Washington, DC',
locale: 'FR',
limit: 10
}).then(console.log);