I’m using a ionic-stencil-starter-pwa project https://github.com/ionic-team/ionic-pwa-toolkit and I need to detect the platform because I will build the app using appflow for ios and android and I need to do some things only in a certain platform.
I don’t use cordova or angular but vanilla javascript.
I’ve found this https://ionicframework.com/docs/native/device and I’ve installed it but I have doubts how to use it.
import { Device } from '@ionic-native/device';
...
export class myClass {
....
device: typeof Device;
...
but if I do “npm run build
” i have this error:
[ ERROR ] TypeScript: ./node_modules/@ionic-native/device/index.d.ts:1:35
Cannot find module '@ionic-native/core' or its corresponding type declarations.
L1: import { IonicNativePlugin } from '@ionic-native/core';
L2: /**
I don’t really understand why this problem appears because I’ve installed the plugin like the documentation says