-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import failures without the .js postfix #1997
Comments
OK, Having looked around the Traceur code, I think I see what's happening... The fetch call assumes the address given is a fully resolved address, but when you miss the .js postfix, this is false. There are several levels this can be fixed at:
(2) looks like it's probably the best way to go. I'll put together a pull request to experiment with this fix. |
This is intentional. We made this change to better match the upcoming spec. |
I see. In that case I need to file a bug in the compiler that is producing the import statements that miss the |
@iislucas The spec is still work in progress but here is where things will be fleshed out further: http://whatwg.github.io/loader/#browser-loader-prototype-%40%40resolve |
@arv Thanks! At the moment, Typescript doesn't create import statements with ".js" postfixes - they are waiting for spec to solidify. This means that the es6 created by Typescript is incompatible with Traceur. Would you object to me creating a pull request that, if the name doesn't end in ".js" and the file doesn't exist without the ".js" postfix, then the TraceurLoader tries adding/loading a filename with ".js" postfixed to the filename? (I'd really like a way to have Traceur be compatible with TypeScript). |
Given:
test.js:
toylib.js:
However, if I change the import statement to:
import * as toylib from "./toylib.js"
, then it compiles as expected.I think ES6 is supposed to correctly guess
.js
extensions (from looking at places like: http://www.2ality.com/2014/09/es6-modules-final.html and https://github.com/ModuleLoader/es6-module-loader/wiki/Brief-Overview-of-ES6-Module-syntax and http://www.ecma-international.org/ecma-262/6.0/index.html#table-40 )The text was updated successfully, but these errors were encountered: