ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
127 stars 85 forks source link

Cannot find module "." #1038

Open gzf6 opened 5 years ago

gzf6 commented 5 years ago

I'm submitting a ... (check one with "x") [ x] bug report [ ] feature request

Current behavior:

ionic info

Ionic:

   ionic (Ionic CLI)  : 4.12.0
   Ionic Framework    : ionic-angular 3.9.6
   @ionic/app-scripts : 3.2.3

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 6.4.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 31 other plugins)

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v10.15.3 
   npm               : 6.4.1
   OS                : Windows 10

when I use ionic cordova build android --debug --aot --minifyjs --optimizejs --minifycss to build an apk, the apk console report " Cannot find module "." ";

then I use ionic cordova build android --debug --minifyjs --optimizejs --minifycss , everything is fine.

Expected behavior:

ionic cordova build android --debug --prod can success

StefanRein commented 5 years ago

@gzf6 Can you search your project and verify that this does not help:

https://forum.ionicframework.com/t/runtime-error-cannot-find-module/93967/3

I remember having this problem, too and this thread did not help me. My imports were fine. Maybe you can check following if the above one will not work:

Circular dependencies? But usually they appear with a question mark in an error message in the constructor of a class. Another thing I can remember was that somehow the whole bundling got confused by having multiple exports in a file. So by having exactly only one export per file I did not have these issues since then.