Skip to content

ES6 imports breaking client in Expo #5485

@BrianUribe6

Description

@BrianUribe6

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

TypeScript

Describe the bug

Relative Imports now include a "index.js" suffix which seems to be causing issues when bundling in React native/expo.

Possible related issue #4950

Imports are currently generated as 
// @ts-ignore
import { DocumentsRequestBuilderNavigationMetadata, type DocumentsRequestBuilder } from './documents/index.js';
// @ts-ignore
import { ProfilesRequestBuilderNavigationMetadata, ProfilesRequestBuilderRequestsMetadata, type ProfilesRequestBuilder } from './profiles/index.js';
// @ts-ignore
import { ThreadsRequestBuilderNavigationMetadata, type ThreadsRequestBuilder } from './threads/index.js';

Example error message by Expo

Android Bundling failed 63ms C:\Users\[REDACTED]\node_modules\expo-router\entry.js (1 module)
Unable to resolve "../../../models/index.js" from "lib\api\v1\auth\register\index.ts"

Expected behavior

Imports should be generated as

// @ts-ignore
import { DocumentsRequestBuilderNavigationMetadata, type DocumentsRequestBuilder } from './documents';
// @ts-ignore
import { ProfilesRequestBuilderNavigationMetadata, ProfilesRequestBuilderRequestsMetadata, type ProfilesRequestBuilder } from './profiles';
// @ts-ignore
import { ThreadsRequestBuilderNavigationMetadata, type ThreadsRequestBuilder } from './threads';

Or provide an additional flag to override the default behaviour.

How to reproduce

Generate any typescript client with kiota generate

Open API description file

No response

Kiota Version

1.18.0+5c6b5d0ef23865ba2f9d9f0b9fe4b944cf26b1ec

Latest Kiota version known to work for scenario above?(Not required)

1.15

Known Workarounds

  • Search and replace to remove "/index.js".
  • Downgrade to version 1.15

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

This is most likely due to  #4815 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Waits for author 🔁

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions