|
27 | 27 | import com.google.common.collect.Sets; |
28 | 28 | import com.google.javascript.jscomp.CompilerOptions.IncrementalCheckMode; |
29 | 29 | import com.google.javascript.jscomp.CompilerOptions.LanguageMode; |
| 30 | +import com.google.javascript.jscomp.deps.ModuleLoader.ResolutionMode; |
30 | 31 | import com.google.javascript.jscomp.parsing.Config; |
31 | 32 | import io.bazel.rules.closure.BuildInfo.ClosureJsLibrary; |
32 | 33 | import io.bazel.rules.closure.worker.CommandLineProgram; |
@@ -132,6 +133,11 @@ public final class JsChecker { |
132 | 133 | usage = "Invert exit code and disable printing warnings") |
133 | 134 | private boolean expectFailure; |
134 | 135 |
|
| 136 | + @Option( |
| 137 | + name = "--module_resolution", |
| 138 | + usage = "Specifies how the compiler locates modules") |
| 139 | + private String moduleResolution = ResolutionMode.BROWSER.name(); |
| 140 | + |
135 | 141 | @Option( |
136 | 142 | name = "--help", |
137 | 143 | usage = "Displays this message on stdout and exit") |
@@ -182,6 +188,7 @@ private boolean run() throws IOException { |
182 | 188 | options.setPreserveDetailedSourceInfo(true); |
183 | 189 | options.setEmitUseStrict(false); |
184 | 190 | options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE); |
| 191 | + options.setModuleResolutionMode(ResolutionMode.valueOf(moduleResolution)); |
185 | 192 | JsCheckerErrorFormatter errorFormatter = |
186 | 193 | new JsCheckerErrorFormatter(compiler, state.roots, labels); |
187 | 194 | errorFormatter.setColorize(true); |
|
0 commit comments