import ModuleSpecifier

# Mark Volkmann (9 years ago)

I was under the impression that the following is a valid import statement:

import {something} from './somefile';

I know this used to work in Traceur. However, in the latest version of Traceur I have to include a file extension like this for it to work:

import {something} from './somefile.js';

I don't see any place in the spec. where it describes whether ModuleSpecifier should include a file extension. Maybe I just missed it. Is Traceur correct to require it?

# Domenic Denicola (9 years ago)

It is syntactically valid, but there is no specification for what the module specifier string should contain. Traceur has one rule, and if you’re using Traceur you need to follow Traceur’s rules. I’m sure other transpilers have their own chosen rules.

In a hypothetical future where browsers have a module loader, they will have their own rule. Similarly, io.js will have its own.

# Mark Volkmann (9 years ago)

Are you saying that in the future each browser can have its own rule for module specifier strings?

# Domenic Denicola (9 years ago)

Yes, in theory. However, browsers are more likely to wait until there’s a standard for browser module loaders before shipping modules, in order to avoid such divergent behavior.

But, I doubt that io.js, Traceur, etc. will follow the browser-loader standard. For example io.js will likely have a loader that is more in line with their current ES5 one, and transpilers will probably contain a way of switching between io.js and browser behaviors, at the bare minimum.

# Brendan Eich (9 years ago)

Browsers in any semi-competitive market will agree on a standard. I don't see why that needs to be called into doubt, even as part of a "hypothetical future" :-|. (Is there another kind? :-P)

# John Barton (9 years ago)

This same claim could be made about every item in ECMAScript. Implementation variation in ModuleSpecifiers is no different from variation in the allowed keywords, character set, or really anything a developer types. Failing to specify this aspect of the language makes no sense to this developer at least.

# Erik Arvidsson (9 years ago)

Don't worry. It is going to be spec'ed as part of the module loader spec. whatwg.github.io/loader

# Brendan Eich (9 years ago)

Who is failing to do what now? :-/