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

Can't find module with extension .es6 #9551

Closed
dbaeumer opened this issue Jul 7, 2016 · 9 comments
Closed

Can't find module with extension .es6 #9551

dbaeumer opened this issue Jul 7, 2016 · 9 comments
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Jul 7, 2016

From @aikeru on July 6, 2016 19:0

  • VSCode Version: 1.2.1
  • OS Version: Windows 8.1

Some projects I work on use .es6 extension for JavaScript files that import/export using ES6 module syntax.

While webstorm and webpack seem to have no issues with this setup, VSCode gives a red squiggly saying [js] Cannot find module './filename.es6'.

Is there some way to get VS Code to find modules imported that do not have a .js extension? We would like to use .jsx in a similar fashion.

I have this for a .jsconfig:

    {
        "compilerOptions": {
            "target": "ES6",
            "module": "commonjs"
        },
        "files": [
            "**/*.jsx",
            "**/*.es6",
            "**/*.js"
        ]
    }

...and tried adding .es6 under user settings for VSCode, but suspect I did it wrong or that doesn't solve the issue.

Also opened StackOverflow here:
https://stackoverflow.com/questions/38046039/vs-code-es6-extensions-cant-find-module

Copied from original issue: microsoft/vscode#8816

@dbaeumer
Copy link
Member Author

dbaeumer commented Jul 7, 2016

@aikeru jsx is support but es6 to my knowledge not. Moving to TS team for further clarification.

@dbaeumer
Copy link
Member Author

dbaeumer commented Jul 7, 2016

TS team: for 2.0 I saw that you support arbitrary file extensions by use setting the kind on open. Would there be more we need to do to make this work.

@mhegazy
Copy link
Contributor

mhegazy commented Jul 7, 2016

es6 is not a supported extension. only js, jsx, ts, and tsx.

@mhegazy mhegazy closed this as completed Jul 7, 2016
@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 7, 2016
@aikeru
Copy link

aikeru commented Jul 7, 2016

Wow, hang on a second ... The extension ".es6" is widely supported amongst the community. VSCode supports it for editing JavaScript out of the box as do competing tools like Webstorm.

".es6" might not be the best extension to use, but a lot of people have good/practical reasons for using an extension other than ".js". For codebases where this decision was already made some time ago, it's a hard sell to make that change just because VSCode doesn't support it.

I realize this is the TypeScript repo, but since my issue was moved here I assume VS Code depends on TypeScript internals to get its intellisense for JavaScript across modules.

Couldn't the extensions for what constitutes a "JavaScript" file be made configurable? That would be a great feature and enabling the use of VS Code in repositories like the ones I have to work in every day.

Please consider this.

@dbaeumer
Copy link
Member Author

dbaeumer commented Jul 7, 2016

@mhegazy I think the tsserver should consider supporting a configurable set of file extensions. Most editors support to map a file extension to a language mode. Not supporting this in the tsserver makes the story pretty incomplete for the editor/user since for example es6 file would get the right syntax coloring and snippets but not the correct JS smartness.

@mhegazy mhegazy reopened this Jul 7, 2016
@mhegazy mhegazy added Suggestion An idea for TypeScript In Discussion Not yet reached consensus and removed Working as Intended The behavior described is the intended behavior; this is not a bug labels Jul 7, 2016
@aikeru
Copy link

aikeru commented Jul 7, 2016

@mhegazy @dbaeumer thanks, guys! :) Will be hopefully watching this!

@aikeru
Copy link

aikeru commented Aug 22, 2016

This issue is still not resolved with VS Code version 1.4.0.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 15, 2016

There has been multiple requests around this area. I have files a new issue #10939 to track this change. Please move the conversion to the new issue.

@mhegazy mhegazy closed this as completed Sep 15, 2016
@mhegazy mhegazy added Duplicate An existing issue was already created and removed In Discussion Not yet reached consensus labels Sep 15, 2016
@aikeru
Copy link

aikeru commented Mar 30, 2017

That issue has now been closed in favor of #11158 which has to do with JSX, and doesn't address this use case or the problems it creates downstream.

@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 Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants