Skip to content

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #21

Description

@creage

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions