# Cannot find module "@types/google-maps" in --prod builds

**URL:** <https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560>\
**Category:** ionic-v3\
**Created:** [December 28, 2016, 1:18pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560 "2016-12-28T13:18:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajrnz](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@ajrnz](https://forum.ionicframework.com/u/ajrnz)\
**Post date:** [December 28, 2016, 1:18pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560/1 "2016-12-28T13:18:11Z")

</div>

i have an app which uses google maps. I added the type definitions via

```
npm install @types/google-maps --save

```

This works for development (`ionic serve`) and development builds (`ionic run android`). However when I try to do an optimized development build via: `ionic run android --prod` I get a white screen. If I connect to the device via Chrome I see the following error:

```
Uncaught Error: Cannot find module "@types/google-maps"
    at Object.<anonymous> (main.js:17)
    at e (main.js:1)
    at Object.<anonymous> (main.js:17)
    at e (main.js:1)
    at Object.<anonymous> (main.js:33)
    at e (main.js:1)
    at Object.<anonymous> (main.js:27)
    at e (main.js:1)
    at Object.<anonymous> (main.js:44)
    at e (main.js:1)

```

Google maps is being loaded from the web in the background (I can see this from the Networks tab). So it is not a permissions issue. It appears to be some sort of runtime dependency problem.

Any ideas on what might be causing this?

Thanks,

Andrew

Other setup:

```
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed
```

---

<div class="post-metadata">

**Author:** ![surajrao](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/surajrao/32/120071_2.png) [@surajrao](https://forum.ionicframework.com/u/surajrao)\
**Post date:** [December 28, 2016, 2:42pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560/2 "2016-12-28T14:42:45Z")

</div>

Try moving @types/google-maps entry to dev dependencies in package.json

---

<div class="post-metadata">

**Author:** ![ajrnz](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@ajrnz](https://forum.ionicframework.com/u/ajrnz)\
**Post date:** [December 28, 2016, 5:29pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560/3 "2016-12-28T17:29:51Z")

</div>

Yeah. I’d tried that. It made no difference.

---

<div class="post-metadata">

**Author:** ![ajrnz](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@ajrnz](https://forum.ionicframework.com/u/ajrnz)\
**Post date:** [December 29, 2016, 4:50pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560/4 "2016-12-29T16:50:42Z")

</div>

Actually I’ve found that it also breaks in `ionic serve`. It works correctly the first time after you load the page and then breaks whenever you modify the page and it is recompiled. The offending JS is:

```
/***/ function(module, exports, __webpack_require__ ) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ angular_core __=__ webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__ (55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ app_services_TransitService __=__ webpack_require__(93);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ app_services_SettingsService __=__ webpack_require__(321);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ stop_stop __=__ webpack_require__(326);
throw new Error("Cannot find module \"@types/google-maps\"");
/* harmony export (binding) */ __webpack_require__.d(exports, "a", function() { return MapDisplay; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};

```

Webpack problem?

This is what it looks like on the first load:

```
/***/ function(module, exports, __webpack_require__ ) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ angular_core __=__ webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__ (55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ app_services_TransitService __=__ webpack_require__(93);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ app_services_SettingsService __=__ webpack_require__(321);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ stop_stop __=__ webpack_require__(326);
/* harmony export (binding) */ __webpack_require__.d(exports, "a", function() { return MapDisplay; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};

```

which is missing the obvious `throw` line

---

<div class="post-metadata">

**Author:** ![surajrao](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/surajrao/32/120071_2.png) [@surajrao](https://forum.ionicframework.com/u/surajrao)\
**Post date:** [January 2, 2017, 1:24pm UTC](https://forum.ionicframework.com/t/cannot-find-module-types-google-maps-in-prod-builds/74560/5 "2017-01-02T13:24:05Z")

</div>

Check this thread: [https://forum.ionicframework.com/t/googe-maps-do-i-have-to-use-ionic-native](https://forum.ionicframework.com/t/googe-maps-do-i-have-to-use-ionic-native)

> [@Googe Maps: Do I have to use Ionic Native?](https://forum.ionicframework.com/t/googe-maps-do-i-have-to-use-ionic-native/74751/19):
>
> I solved this my adding the following to declarations.d.ts /// \<reference path="../node\_modules/@types/googlemaps/index.d.ts" /\> not sure why, I thought npm install is supposed to set this up as needed.
