|
| 1 | +diff --git node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js |
| 2 | +index 031d9dad1..a7fe9b79b 100644 |
| 3 | +--- node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js |
| 4 | ++++ node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js |
| 5 | +@@ -377,10 +377,27 @@ class CompilerHost { |
| 6 | + `which would be overwritten with ${moduleName} ` + |
| 7 | + `by Bazel's TypeScript compiler.`); |
| 8 | + } |
| 9 | +- // Setting the moduleName is equivalent to the original source having a |
| 10 | +- // ///<amd-module name="some/name"/> directive |
| 11 | ++ |
| 12 | ++ // Setting the moduleName is equivalent to the original source having the triple |
| 13 | ++ // slash `///<amd-module name="some/name"/>` directive. Also note that we tag |
| 14 | ++ // source files for which we assigned a generated module name. This is necessary |
| 15 | ++ // so that we can reset the module name when the same source file is loaded from |
| 16 | ++ // a cache, but with a different module format where the auto-generated module |
| 17 | ++ // names are not desirable. The module name should not leak from previous |
| 18 | ++ // compilations through a potential source file cache. |
| 19 | ++ sf._hasGeneratedAmdModuleName = true; |
| 20 | + sf.moduleName = moduleName; |
| 21 | ++ return sf; |
| 22 | + } |
| 23 | ++ |
| 24 | ++ // If the loaded source file has a generated amd module name applied from |
| 25 | ++ // previous compilations (in worker mode), reset the file module name |
| 26 | ++ // as neither the UMD or AMD module format is used (for which we generate |
| 27 | ++ // the AMD module names automatically). |
| 28 | ++ if (sf._hasGeneratedAmdModuleName) { |
| 29 | ++ sf.moduleName = undefined; |
| 30 | ++ } |
| 31 | ++ |
| 32 | + return sf; |
| 33 | + }); |
| 34 | + } |
0 commit comments