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 #8816

Closed
aikeru opened this issue Jul 6, 2016 · 9 comments
Closed

Can't find module with extension .es6 #8816

aikeru opened this issue Jul 6, 2016 · 9 comments
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@aikeru
Copy link

aikeru commented Jul 6, 2016

  • 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

@dbaeumer
Copy link
Member

dbaeumer commented Jul 7, 2016

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

@dbaeumer dbaeumer removed their assignment Jul 7, 2016
@dbaeumer
Copy link
Member

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.

@dbaeumer
Copy link
Member

dbaeumer commented Jul 7, 2016

This issue was moved to microsoft/TypeScript#9551

@dbaeumer dbaeumer closed this as completed Jul 7, 2016
@dbaeumer dbaeumer self-assigned this Jul 7, 2016
@dbaeumer dbaeumer added typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Jul 7, 2016
@aikeru
Copy link
Author

aikeru commented Jul 7, 2016

@dbaeumer I appreciate the quick response and clarification. If I just rename the files to ".js" extension, everything works in VS Code. It's only the difference of extension that seems to matter. I'd like to switch, but you know how it is... :)

Does this further confirm that it is, indeed, a TypeScript issue?

@dbaeumer
Copy link
Member

dbaeumer commented Jul 7, 2016

It is a TS issue. Especially when it comes to resolving file. Consider the case weher eyou have a JS file A which import a JS file B. The import statement usually doesn't include the file extension. So the TS/JS server (yes the JS support is power by the TS language server :-)) needs to know the list of valid file extensions that could contain JS code.

@aikeru
Copy link
Author

aikeru commented Jul 7, 2016

@dbaeumer
EDIT: I see this has been reopened on the TypeScript side! Yay! :)

@aikeru
Copy link
Author

aikeru commented Mar 30, 2017

Sadly, this still seems to be an issue in VS Code (January 2017 v1.9) and the issue on the TypeScript repo seems to have been closed without taking this use case into account microsoft/TypeScript#10939
This is one of the things driving teams I work with away from VS Code. Regardless of whether it's a good idea, the reality is asking teams to move away from .ES6 extension (and virtually every editor/IDE has the ability to configure a custom extension for a given file type) is a non-starter just for the sake of supporting a specific editor/tool.

@dbaeumer
Copy link
Member

@mjbvz @waderyan can you follow up.

@waderyan waderyan removed their assignment Mar 31, 2017
@leeight
Copy link

leeight commented May 5, 2017

+1

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

5 participants