Skip to content
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

Does tsc support importing for relative path with extension? #5587

Closed
unional opened this issue Nov 10, 2015 · 6 comments
Closed

Does tsc support importing for relative path with extension? #5587

unional opened this issue Nov 10, 2015 · 6 comments
Labels
Duplicate An existing issue was already created

Comments

@unional
Copy link
Contributor

unional commented Nov 10, 2015

Currently import myClass from './myClass.ts'; transpile to var myClass_ts_1 = require('./myClass.ts')'.

Since myClass.ts is transpile to myClass.js, the transpiled code does not work.

I try to stick to pure ES6 as much as possible so I want to avoid using internal module syntax.

Thanks!

@unional
Copy link
Contributor Author

unional commented Nov 10, 2015

FYI doing jspm bundle to transpile the code works as it is transpiled to System.register('./myClass.ts', ...) therefore the referencing still work correctly.

@vladima
Copy link
Contributor

vladima commented Nov 10, 2015

out of curiosity, why do you need to specify an extension in import? import myClass from "./myClass" should also work

@unional
Copy link
Contributor Author

unional commented Nov 10, 2015

Because that is the suggested convention for referencing the file name. As in:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
https://hacks.mozilla.org/2015/08/es6-in-depth-modules/

excerpt:
module-name: The name of the module to import. This is a file name.

systemjs will also depreciate defaultJSExtension in the future.

I can't remember the exact reason.

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Nov 10, 2015
@weswigham
Copy link
Member

Duplicates #4595?

@unional
Copy link
Contributor Author

unional commented Nov 10, 2015

Yes it is the same issue, but targeting compile/transpile logic in tsc instead of loading in application. The objective is to create a npm/jspm module that is transpiled.

I have a related issue on jspm that tries to see if a pure, raw typescript module is possible.

@mhegazy mhegazy added Duplicate An existing issue was already created and removed Needs More Info The issue still hasn't been fully clarified labels Nov 13, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Nov 13, 2015

They both seem to be stemming form the same issue. we need to reach a solution, we have been waiting on the loader spec to solidify.

@mhegazy mhegazy closed this as completed Nov 13, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants