Skip to content

Commit f1a67da

Browse files
committed
Allow .js at the end of module names
Issue google#1221
1 parent 0a93223 commit f1a67da

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/runtime/TraceurLoader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ export class TraceurLoader extends Loader {
6363
load.metadata.traceurOptions = load.metadata.traceurOptions || {};
6464
var options = load.metadata.traceurOptions;
6565
var asJS;
66-
if (options && options.script) {
66+
if (options && options.script || /\.js$/.test(normalizedModuleName)) {
6767
asJS = normalizedModuleName;
6868
} else {
69+
// Backwards compat.
6970
asJS = normalizedModuleName + '.js';
7071
}
7172

test/unit/runtime/Loader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ suite('Loader.js', function() {
6565
load.normalizedName = 'abc/def';
6666
assert.equal(loader.locate(load), 'http://example.org/a/abc/def.js');
6767
load.normalizedName = 'abc/def.js';
68-
assert.notEqual(loader.locate(load), 'http://example.org/a/abc/def.js');
68+
assert.equal(loader.locate(load), 'http://example.org/a/abc/def.js');
69+
load.normalizedName = './abc/def.js';
70+
assert.equal(loader.locate(load), 'http://example.org/a/abc/def.js');
6971
});
7072

7173
test('traceur@', function() {

0 commit comments

Comments
 (0)