angular-google-maps
angular-google-maps copied to clipboard
Can't import 'angular-google-maps'
I am working on ES6, gulp-babel, And here's the problem. I added following 3 lines to app.js
import _ from 'lodash'; import angular from 'angular'; import 'angular-google-maps';
And third line gives error "angular-google-maps.js:14022 Uncaught ReferenceError: _ is not defined". Could someone let me know what's the problem?
+1 for this issue. I am having the exact same issue with the same setup.
I see this error in 2.3.4 but it goes away when I revert to 2.3.3
it was introduced by https://github.com/angular-ui/angular-google-maps/commit/bb083cd640b22c4f398ff969c9df4502f2810131, it's expecting a lodash global, but it doesn't work with loaders, even JSPM (that uses SystemJS), if you are using npm:lodash, since it won't export a global.
my "hack" to fix this issue (since angular-google-maps is the only module misbehaving) is to force lodash as a global, if you are using JSPM, you can do it using
jspm install npm:lodash -o "{'format': 'global', 'main':'lodash.min.js', 'meta': { 'lodash.min.js':{'exports': '_', 'format': 'global'} }}"
The acceptance tests in this module is lackluster. js-rich-marker is another dependency that has to be hacked when using loaders for it to work. I'm having to use my own fork so I can use it https://github.com/pocesar/js-rich-marker/tree/1.0.0
If someone added some grunt-babel processing to some JS, specs to test ES6 importing then I could work to satisfy those specs.