-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ReactNativeManualDevicePlugin - Cannot find module @microsoft/applicationinsights-react-native/dist-esm/manualIndex #46
Comments
I have seen this at times, and documented as is a hack because not all build environment support the new entry points. I suspect that if you throw a ".js" onto the end of the import that it (should) work as the file exists but the version of TypeScript you are using (or the mode its running in) doesn't like / infer the import type. |
@MSNev Adding ".js" didn't fix the issue. When I'm trying to use ReactNativePlugin, for a non-expo app, I'm getting quite similar issue: Are you sure of your package.json or typing ? |
maybe try:
|
I am getting the same issue as @yoannHertienne described. Any news on that? |
@Karlie-777 I tried your solution, but I was not able to fix it, still typescript error to import your module. |
@siyuniu-ms it seems that all manual device interfaces applicationinsights-react-native/applicationinsights-react-native/src/manualIndex.ts Line 9 in aa2b586
index.ts https://github.com/microsoft/applicationinsights-react-native/blob/main/applicationinsights-react-native/src/index.ts
|
Hi, @yoannHertienne @luanlcampos Could you check whether the provided sample app https://github.com/microsoft/applicationinsights-react-native/tree/main/sample works for you? |
Could you also check the typescript version in the node_modules folder? Based on the conversation in https://stackoverflow.com/questions/70296652/how-can-i-use-exports-in-package-json-for-nested-submodules-and-typescript, typescript that has version lower than 4.7 didn't support export (which may cause the issue of not finding the right type files.) |
I'm using "typescript": "5.4.5". |
I tried your sample, and after installing Eslint and typescript, import is not giving any error. I will create new project from scratch and import your library. |
@Karlie-777 @siyuniu-ms I tested the sample project again and with typescript, it's not working and give me the same error.
So it's working with Javascript, but not with Typescript |
Hi! Is there any news about this? :-) I get the same issue in my Expo app. It seems like the type definition (manualIndex.d.ts) is not working when importing since it's implicitly has an 'any' type. I'm importing with |
We've experienced this exact same problem when running our tests using Jest 29 simply importing the below:
After lots of trial and error I found that the last working version was the combination below:
Clearly something was introduced after this ( Update: |
Description/Screenshot
Following your documentation, I'm using Expo, so I import ReactNativeManualDevicePlugin using
import { ReactNativeManualDevicePlugin } from "@microsoft/applicationinsights-react-native/dist-esm/manualIndex"
but then I'm getting the following Typescript error


Steps to Reproduce
"@microsoft/applicationinsights-react-native": "^4.1.1",
"@microsoft/applicationinsights-web": "^3.2.0",
`import { ApplicationInsights, IApplicationInsights } from "@microsoft/applicationinsights-web"
import { ReactNativeManualDevicePlugin } from "@microsoft/applicationinsights-react-native/dist-esm/manualIndex"
import { myDeviceInfoModule } from "../../config/appInsight-device.ts"
// MS ApplicationInsights
const RNMPlugin = new ReactNativeManualDevicePlugin()
RNMPlugin.setDeviceInfoModule(myDeviceInfoModule)
const appInsight = new ApplicationInsights({
config: {
connectionString: Config.APPINSIGHT_CONNECTION_STRING,
extensions: [RNMPlugin],
},
})
appInsight.loadAppInsights()`
Expected behavior
Typescript should detect the module. I have the same issue with my Unit Test using Jest
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: