Browse Source

check provided size

ming 7 năm trước cách đây
mục cha
commit
9bfed46c41
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      src/google/protobuf/compiler/js/js_generator.cc

+ 2 - 1
src/google/protobuf/compiler/js/js_generator.cc

@@ -3477,7 +3477,8 @@ void Generator::GenerateFile(const GeneratorOptions& options,
     GenerateExtension(options, printer, *it);
   }
 
-  if (options.import_style == GeneratorOptions::kImportCommonJs) {
+  // if provided is empty, do not export anything
+  if (options.import_style == GeneratorOptions::kImportCommonJs && provided.size()) {
     printer->Print("goog.object.extend(exports, $package$);\n",
                    "package", GetFilePath(options, file));
   }