[js-flatten] Always use dot path for extern classes and enums (closes #2132)