aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/google/protobuf/compiler/js/js_generator.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index 2dea60fa..7ebb9b12 100755
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -1466,13 +1466,6 @@ void Generator::GenerateClass(const GeneratorOptions& options,
GenerateClassExtensionFieldInfo(options, printer, desc);
}
- if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) {
- printer->Print(
- "exports.$name$ = $fullName$;\n",
- "name", desc->name(),
- "fullName", GetPath(options, desc));
- }
-
if (options.import_style != GeneratorOptions:: IMPORT_CLOSURE) {
for (int i = 0; i < desc->extension_count(); i++) {
GenerateExtension(options, printer, desc->extension(i));
@@ -2552,6 +2545,11 @@ void Generator::GenerateFile(const GeneratorOptions& options,
for (int i = 0; i < file->extension_count(); i++) {
GenerateExtension(options, printer, file->extension(i));
}
+
+ if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) {
+ printer->Print("goog.object.extend(exports, $package$);\n",
+ "package", GetPath(options, file));
+ }
}
bool Generator::GenerateAll(const vector<const FileDescriptor*>& files,