From e8aa6353974520ebb1d3c0e275a8dccc60a93ff1 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 4 Feb 2021 17:04:17 -0800 Subject: [PATCH] Tweak our JavaScript rewrites a bit to handle jspb.* imports. --- js/commonjs/rewrite_tests_for_commonjs.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/commonjs/rewrite_tests_for_commonjs.js b/js/commonjs/rewrite_tests_for_commonjs.js index b6d90d287..82eef18ed 100644 --- a/js/commonjs/rewrite_tests_for_commonjs.js +++ b/js/commonjs/rewrite_tests_for_commonjs.js @@ -80,6 +80,8 @@ lineReader.on('line', function(line) { if (isRequire) { if (module) { // Skip goog.require() lines before the first directive. var fullSym = isRequire[1]; + // Skip lines importing from jspb.*, these are handled by the header above. + if (fullSym.match(/^jspb\./)) return; var sym = tryStripPrefix(fullSym, pkg); console.log("googleProtobuf.exportSymbol('" + fullSym + "', " + module + sym + ', global);'); }