-
Notifications
You must be signed in to change notification settings - Fork 47
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
An import path cannot end with a ".ts" extension. (TS 2.0.3) #162
Comments
I think you need to add the |
@jlost using jspm 0.17.0-beta.28 here and Here is what your config should look like. packages: {
"pets-gui": {
"main": "main.ts", // or just "main"
"defaultExtension" : "ts",
"meta": {
"*.ts": {
"loader": "plugin-typescript"
}
}
}
} Note that in the above you cannot use "main.js" it must be "main.ts" or simply "main". The change in TypeScript behavior should not affect you. Importing files with an explicit .ts extension was never supposed to work and it doesn't need to. Even though it worked in the past it was a bad practice because it coupled your source to how it was transpiled. |
Users of plugin-typescript are very much affected. Now we must have separate directories for TS, JS, TSX, and JSX files. So we get no benefits from the decoupling. If we ever needed to change the file extension, we will still have to change our import statements and the file name, but now we also have to change the directory. Edit: @aluanhaddad enlightened me as to why extensions can't work. I still feel we need a way to handle multiple transpilation types in a single directory. |
@mavericken I see the problem. You have multiple source extensions in the same directory and thus setting |
@aluanhaddad Well, for TypeScript compiler itself, extension-less can already do the same thing, as it will also find the .ts or .tsx file. I feel that the role of plugin-typescript is to allow any valid typescript to be imported into SystemJS. Right now, this is not the case, as a valid typescript can contain both TS and TSX files in the same folder, but SystemJS + Plugin-Typescript cannot do that, so currently there exists valid typescript programs which Plugin-Typescript cannot support. Edit: I have proposed a change to plugin-typescript that could handle it: #173 |
Generating a new project with jspm init and specifying typescript as my transpiler, the convention for picking up typescript files is as follows:
My understanding is that this means everything with the .ts extension in the import is run through the typescript transpiler plugin.
However, Typescript 2.0.3 (called externally for intellisense) will report this as an error:
An import path cannot end with a ".ts" extension. Consider importing './app.routing' instead
, for instance. Of course, if I do that, the .ts files aren't transpiled by systemjs, and it just reports 404's as it tries to load "./app.routing" which doesn't exist.Is there a work-around so I don't have to choose between SystemJS and my intellisense?
Apologies if this is the wrong place to raise this issue. Originally reported at jspm/jspm-cli#2103
The text was updated successfully, but these errors were encountered: