angular-ui/angular-google-maps

trying to get this working with webpack

grantm44 opened this issue · 2 comments

I'm trying to use angular google maps with webpack.
getting this error
[$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:nomod] Module 'app' is not available!

this is client.js file

var angular = require('angular');
require('angular-google-maps');
require('angular-simple-logger');

angular.module('app', ['ngRoute', 'uiGmapgoogle-maps', 'nemLogging']).config(['uiGmapGoogleMapApiProvider', function(GoogleMapApiProviders){
  GoogleMapApiProviders.configure({
    key: '',
      //v: '3.20'
    libraries: 'weather,geometry,visualization,places'
  });

}]);

require('./controllers');

webpack.config.js file

var webpack = require('webpack');
var path = require('path');

module.exports = {
  context: __dirname + '/client',
  entry: {
    app: './client.js',
    vendor: [
      'jquery',
      'angular',
      'angular-route',
      'angular-sanitize',
      'bootstrap',
      'angular-google-maps',
      'angular-simple-logger',
      'lodash'

    ]
  },
  output: {
    filename: 'script.bundle.js',
    path: __dirname + '/public/scripts'
  },
  resolve: {
    plugins: [
      new webpack.ProvidePlugin({
        $:'jquery',
        jQuery: "jquery",
        "_": "lodash"
      })
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({name: 'vendor', filename: 'vendor.bundle.js'})
  ]
};

I have scripts included in index.html like so

    <script src="scripts/vendor.bundle.js"></script>
    <script src="scripts/script.bundle.js"></script>

I'm having trouble getting it to load too. Just including uiGmapgoogle-maps causes my app to not load. Have you had any success since posting?

Never mind, got it working now. I followed @dmackerman's advice from this issue: #1633 (comment)

Basically, I require/import the angular-simple-logger before angular-google-maps and include the nemLogging module in my app. Worked a treat.