Skip to content

Commit

Permalink
JsChecker: support extensionless ES6 imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Figueiredo committed Aug 15, 2019
1 parent b2a6fb7 commit 67d975d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions java/com/google/javascript/jscomp/CheckStrictDeps.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ private void visitEs6Import(NodeTraversal t, Node n) {
private void checkNamespaceIsProvided(NodeTraversal t, Node n, String namespace) {
if (namespace.startsWith("/") || namespace.startsWith(".")) {
// TODO(jart): Unify path resolution with ModuleLoader.
// NOTE(robfig): To enable usage of extensionless ES6 modules,
// copy these 3 lines from NodeModuleResolver.java.
if (!namespace.endsWith(".js")) {
namespace += ".js";
}

Webpath me = Webpath.get(t.getSourceName());
if (!me.isAbsolute()) {
me = Webpath.get("/").resolve(me);
Expand Down

0 comments on commit 67d975d

Please sign in to comment.