we have a large Ionic app that we’re trying to build in production mode since it’s almost ready. The first issue we found is that we were getting a “JavaScript heap out of memory” error when compiling, but we fixed it by giving more memory to node:
With this command the app successfully builds, but if I open it I get the following error:
Uncaught Error: Cannot find module “.”
at vendor.js:1
at vendor.js:1
at Object. (vendor.js:1)
at e (vendor.js:1)
at Object. (main.js:1)
at e (vendor.js:1)
at window.webpackJsonp (vendor.js:1)
at main.js:1
I searched a bit and I found that it could be caused by require, but we aren’t using it. Any idea of what could be going on or what we can do to debug the issue? Is there any way to use “–prod” without minifying the JS?
I have the same problem, but if I downgrade to less than typescript 3 I screw up my angular 7 dependency. Isn’t thare any patch for this problem? I read something about this having to do with angular’s ahead of time compiler…
In my case, with typescript 2.7 and rxjs 6 I can’t build. But if I update to typescript 2.9 the production build brings the module “.” error on runtime. Finally typescript 2.8 seems to works.
Does anyone have a solution to this? Like mentioned before, downgrading is a workaround that doesn’t work for everyone. I use Angular 7, rxjs and I can’t downgrade to typescript < 3.1.1. I am also on Ionic 4 as suggested. Here’s my Ionic Info:
Nope. I could not. I had to rollback all the upgrades I had made (including Angular and rxjs) and change some code that didn’t work in these old versions. Very frustrating but that was the only way to move forward, unfortunately.
In a production build, I had the same problem using TypeScript 3.5.x. I tried the suggested downgrade to TypeScript 2.8.x and I was able to load a production build successfully. I had a few places where I was using newer TypeScript features that I needed to code differently, but it loads now.
Well, I have the same error, but setting the typescript version to 2.7.2 or 2.6.2 didn’t help.
To give more background… The app used to work with what was probably typescript 2.6.2, then I needed to use some component that didn’t work for me, so I basically updated everything including ionic and it broke my build (ionic serve still works of course). Now I tried to reconstruct the previous state from the package-lock and package from when it worked. I did so and it didn’t help. Now I tried messing with the typescript version, but it also doesn’t help.
Now I think that the only thing that is different is the ionic version. At this point I am running 3.9.2 as does the OP. I would go back but I have no idea which version I was using before. I do not remember… I had it installed globally, so I have no package.json history for that.
Any ideas on how to either solve the problem or find out the ionic version that I was using before? Some logs maybe…
Thanks
//edit: I have also tried updating app-scripts and cordova, but still getting the same error…
Any ideas what other stuff can I try to get it working? At this point, whatever I do, I just get white screen… And the error in console described by the OP.