question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

angular2-google-maps not work with Angular 4 AOT build

See original GitHub issue

I’m using the new angular 4 quickstart seed app: https://angular.io/docs/ts/latest/guide/setup.html

I’m running an npm build:aot in git bash and I get the following bash error:

“‘AgmCoreModule’ is not exported by node_modules/angular2-google-maps/core/index.js”

Version of angular 2 google maps: “angular2-google-maps”: “^0.17.0”,

My home module thats using it:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AgmCoreModule } from 'angular2-google-maps/core/index.js';

import { HomeComponent } from './home.component';

@NgModule({
  imports: [CommonModule, AgmCoreModule.forRoot({apiKey: 'xxx'})],
  declarations: [HomeComponent],
  exports: [HomeComponent]
})
export class HomeModule { }

This is my systemjs.config:

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'app': 'app',

      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
      'angular2-google-maps':      'npm:angular2-google-maps/core'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        defaultExtension: 'js',
        meta: {
          './*.js': {
            loader: 'systemjs-angular-loader.js'
          }
        }
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Ledzzcommented, Apr 13, 2017

Please read the docs angular-cli is not related to this repo so I suggest you to stop offtopic

1reaction
markoddicommented, Apr 13, 2017

i do an ng build --prod --aot --output-hashing=none which creates the dist folder for production release fine. Next I want to serve that dist folders index to check the aot performance

Read more comments on GitHub >

github_iconTop Results From Across the Web

AOT Compilation is not worked. · Issue #629
Issue description angular2-google-maps does not work in the AOT compile. Steps to reproduce and a minimal demo of the problem step 1.
Read more >
Angular Universal does not work with Angular Google Maps
1. Install global dependencies. I have installed: · 2. Create a new Angular project ng new angular-agm · 3. Add Angular universal ng...
Read more >
Ahead-of-time (AOT) compilation
When you run the ng build (build only) or ng serve (build and serve locally) CLI commands, the type of compilation (JIT or...
Read more >
The RxJS library
RxJS provides an implementation of the Observable type, which is needed until the type becomes part of the language and until browsers support...
Read more >
ng build
Option Description Value Type Default Value ‑‑aot Build using Ahead of Time compilation. boolean true ‑‑base‑href Base url for the application being built. string ‑‑delete‑output‑path Delete...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found