Description
Closure Compiler rejects import statements from an absolute URL. This should be easy to support if it just passes them through verbatim. Instead any presence of such a line causes the entire script to fail to compile.
Example in.js:
import test from "https://cdn.example.com/test.js";
Command line:
java -jar ./closure-compiler.jar --js in.js --js_output_file out.js --compilation_level SIMPLE --language_in ECMASCRIPT_2020 --language_out ECMASCRIPT_2020
Observed result:
in.js:2:0: ERROR - [JSC_INVALID_MODULE_PATH] Invalid module path "https://cdn.example.com/test.js" for resolution mode "BROWSER"
2| import test from "https://cdn.example.com/test.js";
^
1 error(s), 0 warning(s)
Expected result:
Output file to contain the same import statement.
Similar to issue #3707, if there is a passthrough module resolution mode, we can just set it to output import statements verbatim and this case will work. This makes it much easier to use Closure Compiler as a general minifier tool, since otherwise the presence of module features causes the whole compilation to fail.