Index: /issm/trunk-jpl/src/c/main/globals.h
===================================================================
--- /issm/trunk-jpl/src/c/main/globals.h	(revision 19713)
+++ /issm/trunk-jpl/src/c/main/globals.h	(revision 19714)
@@ -5,9 +5,9 @@
 #ifndef _GLOBALS_H_
 #define _GLOBALS_H_
-
 #include "../shared/io/Comm/IssmComm.h"
 #include "../toolkits/ToolkitOptions.h"
 
 /*Communicators: */
+#ifndef _DO_NOT_LOAD_GLOBALS_ 
 ISSM_MPI_Comm IssmComm::comm;
 bool IssmComm::parallel;
@@ -17,4 +17,5 @@
  * often used when Petsc is not allowed*/
 char* ToolkitOptions::toolkitoptions;
+#endif
 
 #endif
Index: /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h	(revision 19713)
+++ /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h	(revision 19714)
@@ -15,4 +15,8 @@
 #ifdef _HAVE_PYTHON_
 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+#undef _DO_NOT_LOAD_GLOBALS_
 #endif
 
@@ -66,4 +70,5 @@
 #define SEGMENTS          psegments,pnsegs
 #define SEGMENTMARKERLIST psegmentmarkers,pnsegs
+#define _DO_NOT_LOAD_GLOBALS_//we only load globals for TriMeshModule.js, not other modules!
 #endif
 
Index: /issm/trunk-jpl/src/wrappers/javascript/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/javascript/Makefile.am	(revision 19713)
+++ /issm/trunk-jpl/src/wrappers/javascript/Makefile.am	(revision 19714)
@@ -74,5 +74,5 @@
 IssmModule_SOURCES = ../TriMesh/TriMesh.cpp \
 					 ../NodeConnectivity/NodeConnectivity.cpp
-IssmModule_CXXFLAGS= -fPIC --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule']"  -s DISABLE_EXCEPTION_CATCHING=0
+IssmModule_CXXFLAGS= -fPIC -D_DO_NOT_LOAD_GLOBALS_ --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule']"  -s DISABLE_EXCEPTION_CATCHING=0
 IssmModule_LDADD = ${deps} $(TRIANGLELIB) 
 #}}}
