Ionic Uncaught Error: Cannot find module “.” when importing a service provider

后端 未结 2 946
梦谈多话
梦谈多话 2020-12-17 02:18

I am trying to import a new service provider that I just created after pulling from the latest branch in my ionic app.

When I try to import this line of code:

<
相关标签:
2条回答
  • 2020-12-17 02:36

    I finally figure it out to solve the problem. The error occurs when I import the events from ionic-angular.

    So instead of: import { Events } from 'ionic-angular/umd';

    Just remove the umd at the end. I don't know why it happened because I am using auto import from my vs code.

    0 讨论(0)
  • 2020-12-17 02:48

    I changed import { Events } from 'ionic-angular/umd'; to import { Events } from 'ionic-angular';. I was using "typescript": "~2.6.2". I tried to change the version of typescript and I have heard that typescript 3.1 can be fix in some cases. In my case once i went higher than typescript 2.8.0 I started getting other issues related to ionic. At the end the above fix works, and I think this is more a ionic framework issue.

    0 讨论(0)
提交回复
热议问题