Skip to content

Import modules without the .js extension

Created by: davemevans

Looking at other projects, and in-line with other module systems, it seems to be best practice to omit the .js extension when importing modules.

In our case, since relative path names end up in the minified output, this has the additional benefit of saving approx 3.5k in the minified output for no effort.

Closure Compiler refuses to import ES6 modules unless the extension is omitted (https://github.com/google/closure-compiler/wiki/JS-Modules), so this would be a prerequisite if we wished to try that.

Merge request reports