Skip to content

Module not found: Error: Package path ./locale-data is not exported from package /node_modules/@formatjs/intl-displaynames (see exports field in @formatjs/intl-displaynames/package.json) #4127

@alexeymolchan

Description

@alexeymolchan

@formatjs/intl-displaynames: ^6.4.0,
react-intl: ^6.4.3,
typescript: ^5.1.3,
webpack: ^5.85.1"

tsconfig options:

"compilerOptions": { "module": "esnext", "moduleResolution": "node", }

https://formatjs.io/docs/polyfills/intl-displaynames#dynamic-import--capability-detection

after latest update dynamic loading of locale-data doesn't work.

the same error for @formatjs/intl-numberformat and @formatjs/intl-datetimeformat.

i suppose this is related to wildcard exports property in package.json.

"./locale-data/*": { "types": "./locale-data/*.d.ts", "default": "./locale-data/*.js" },
error thrown only when using dynamic import, import ar from "@formatjs/intl-displaynames/locale-data/ar"; works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions