I have some code that I am trying to get working to show a map and where you are and places close by and other things like that. However, it works fine when I test it out using localhost, but when trying to build the app using package, production, or testing, I receive the error:

Code:
[INFO] Resolving your application dependencies (...)
[ERROR] TypeError: 'undefined' is not an object
Stack trace:
...
Code:
Ext.define("LocationTwo.view.Main",{
    extend: 'Ext.Container',
    requires: [ 'Ext.Map' ],
    
    config:
    {
        layout: 'vbox',
        
        items:
        [
        {
            xtype: 'map',
            useCurrentLocation: false,
            flex: 1,
            
            listeners:
            {
                maprender: function( mapComponent, mapObject, options )
                {
                    console.log( 'maprender' );
                    var create = function( position )
                    {
                    };
                    var error = function( errorInfo )
                    {
                    };
                    var options = { enableHighAccuracy: true };
                    
                    navigator.geolocation.getCurrentPosition( create, error, options );
                }
            }
        }
        ]
    }
});
It seems like something is wrong with the "navigator.geolocation.getCurrentPosition" line or the useCurrentLocation line, because when I comment that line out, everything is fine. Or, if I leave the line uncommented, and change useCurrentLocation to true, it also builds okay. Either way, the application does not output an errors in Google Chrome's console when running.