google-maps-loader icon indicating copy to clipboard operation
google-maps-loader copied to clipboard

Can't resolve 'google-maps/lib/types/index'

Open niklaas opened this issue 4 years ago • 1 comments

I get the following error when building an Angular project that uses an Angular library that uses google-maps-loader:

ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'google-maps/lib/types/index' in '/Users/ngersdorff/git/ng-library-testproject/src/app'

I could fix this by adding the lines maked with X to tsconfig.app.json of the Angular project that uses the Angular library in question:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "paths": { X
      "google-maps/lib/types/index": [ X
        "src/empty.js" X
      ]
    }
  },
  "files": ["src/main.ts", "src/polyfills.ts"],
  "include": ["src/**/*.d.ts"],
  "exclude": ["src/test.ts", "src/**/*.spec.ts"]
}

src/empty.js is completely empty.

I would like to provide a minimal example project that let others reproduce the problem but that would take some time. Before doing so: Do you already have an idea what this issue might be about?

// package.json
{
    ...
    "google-maps": "^4.2.3"
    ...
}

niklaas avatar Jul 14 '20 12:07 niklaas

Hello, do you have some special webpack configuration in your angular project? I'm using this package in angular (versions 8 and 10) without any problems.

davidkudera avatar Sep 28 '20 20:09 davidkudera