diff --git a/java/com/google/javascript/jscomp/CheckStrictDeps.java b/java/com/google/javascript/jscomp/CheckStrictDeps.java index 70109ddbc2..ed3de2e4b8 100644 --- a/java/com/google/javascript/jscomp/CheckStrictDeps.java +++ b/java/com/google/javascript/jscomp/CheckStrictDeps.java @@ -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);