Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Use .js in module names #218

Closed
guybedford opened this issue Sep 24, 2014 · 10 comments
Closed

Use .js in module names #218

guybedford opened this issue Sep 24, 2014 · 10 comments

Comments

@guybedford
Copy link
Member

I believe this is an idea that got quite a bit of support in the last TC39, as mentioned in google/traceur-compiler#1221.

Pending feedback from this current meeting, it may be implementation ready soon. It is only an adjustment to the System loader hooks.

@trusktr
Copy link

trusktr commented Oct 28, 2014

I agree that this should be supported, and optional. e.g. import 'file' and import 'file.js' both import the same file.

@guybedford
Copy link
Member Author

import 'file.js' will load a module file, while import 'file' will load a package.

@trusktr
Copy link

trusktr commented Oct 28, 2014

Ah, I did not know that this whole time. I just thought it was a convenience not to have to type .js on everything since we know everything is JavaScript anyways. I would intuitively think that file is just a file, and it may or may not import everything else in the "package" (e.g. Famo.us doesn't). That's what it seemed like to me.

@nevir
Copy link
Contributor

nevir commented Dec 3, 2014

Related (I think?): it's somewhat annoying to introduce another extension type while supporting both this polyfill and System.js together - you have to insert your paths entry for both System and System.originalSystem

Primarily, because System.js sets up its own copy of paths, rather than honoring the one from es6-module-loader.

Rough example where I needed to do that: https://github.com/nevir/html-exports/blob/master/src/documentloader.js#L17-52

@guybedford
Copy link
Member Author

This sounds like a reference issue - if you're using the SystemJS loader, it will use its own paths. If you use the original System loader it will also use its own paths. Ensure you have the right System reference and there shouldn't be a problem?

@nevir
Copy link
Contributor

nevir commented Dec 3, 2014

Hmm, I'll try to trace it to understand the exact case I'm running into, but: When I hook only SystemJS, modules that I import directly use the SystemJS loader, whereas (some?) modules that are imported transitively fall back to the original loader and its paths. (pretty sure it's not my code; as I don't keep a reference in that case)

@guybedford
Copy link
Member Author

Yes that shouldn't be happening. How is your app bootstrapping? To test, perhaps override System.originalSystem.import and System.import and see where the calls are coming from.

@nevir
Copy link
Contributor

nevir commented Dec 10, 2014

Aha, tracked it down - When SystemJS is loaded, any imports in a <script type="module"> still reference System.originalSystem: https://github.com/nevir/sysjs-testcase (run gulp)

@nevir
Copy link
Contributor

nevir commented Dec 10, 2014

^ fixes it for me

@guybedford
Copy link
Member Author

Great! Thanks for catching this.

On Thursday, December 11, 2014, Ian MacLeod [email protected]
wrote:

^ fixes it for me

Reply to this email directly or view it on GitHub
#218 (comment)
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants