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

Output directory messed up if tsc is triggered as VS Code task. #8837

Closed
vilicvane opened this issue May 26, 2016 · 12 comments
Closed

Output directory messed up if tsc is triggered as VS Code task. #8837

vilicvane opened this issue May 26, 2016 · 12 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@vilicvane
Copy link
Contributor

vilicvane commented May 26, 2016

This only happens if tsc is executed via Code.

TypeScript Version:

nightly (1.9.0-dev.20160525-1.0)

Code

.vscode/tasks.json

{
    "version": "0.1.0",
    "command": "node", // Using npm scripts would result the same.
    "isShellCommand": true,
    "args": ["node_modules/typescript/lib/tsc.js"],
    "showOutput": "silent",
    "problemMatcher": "$tsc"
}

tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "allowJs": true,
        "outDir": "bld",
        "rootDir": "src"
    },
    "exclude": [
        "node_modules",
        "bld"
    ]
}

src/foo/bar.ts

import '../biu/pia';

src/biu/pia.js

// Empty file.

Expected behavior:

Compiles correctly.

Actual behavior:

error TS5055: Cannot write file '.../src/biu/pia.js' because it would overwrite input file.

And if you put another .ts file and import it in src/foo.bar.ts, it would be output as .js file nested to its .ts source.

@Seikho
Copy link

Seikho commented May 27, 2016

Possibly related to microsoft/vscode#6719 ?

@mhegazy mhegazy added Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified labels Jun 7, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jun 7, 2016

@zhengbli any thoughts?

@zhengbli
Copy link
Contributor

zhengbli commented Jun 8, 2016

Seems to be a VSCode task runner issue with node v6, the same as microsoft/vscode#6719. Running tsc from command line doesn't repro the error.

@mhegazy mhegazy added the External Relates to another program, environment, or user action which we cannot control. label Jun 8, 2016
@Seikho
Copy link

Seikho commented Jun 9, 2016

The regression occurs in the cd1af12 commit.

@Seikho
Copy link

Seikho commented Jun 9, 2016

This (L590, program.ts) seems to be the offending change. It changes the capitalisation of the Windows drive letter (lower to upper in the case of microsoft/vscode#6719).

When run from the command line, the drive letter is already capitalised and stays capitalised.

@yortus
Copy link
Contributor

yortus commented Jun 9, 2016

Evidence that @Seikho has identified the problem.

@Seikho
Copy link

Seikho commented Jun 9, 2016

After further digging, it's a change from Node v5 to Node v6 in the behaviour of fs.realpath which is used in L547 sys.ts.

In node v5:

$ node
> process.version
'v5.11.1'
> require('fs').realpathSync('c:\\projects')
'c:\\projects'
>                                     

In node v6:

$ node
> process.version
'v6.2.0'
> require('fs').realpathSync('c:\\projects')
'C:\\projects'
>

@yortus
Copy link
Contributor

yortus commented Jun 9, 2016

@zhengbli could the 'external' tag be removed, and this be dealt with in TypeScript? See microsoft/vscode#6719 (comment).

EDIT: See also comment from node.js contributor about this: nodejs/node#6624 (comment)

@dbaeumer
Copy link
Member

dbaeumer commented Jun 9, 2016

Important observations from microsoft/vscode#6719:

@zhengbli zhengbli removed the External Relates to another program, environment, or user action which we cannot control. label Jun 10, 2016
@zhengbli zhengbli added this to the TypeScript 2.1 milestone Jun 10, 2016
@zhengbli
Copy link
Contributor

@Seikho Thanks for the finding! The issue should be able to address from TypeScript side.

@dbaeumer
Copy link
Member

@zhengbli shouldn't this be addressed in 2.0. It works in 1.8.x and is broken in @next. I am asking since it is tagged for 2.1

@yortus
Copy link
Contributor

yortus commented Jun 13, 2016

Fixing in @next would be great - We've had to disable the VSCode build task for all our affected projects since this surfaced, which is a minor hassle but still a hassle.

@mhegazy mhegazy removed the Needs More Info The issue still hasn't been fully clarified label Jun 16, 2016
@zhengbli zhengbli added the Fixed A PR has been merged for this issue label Jun 20, 2016
@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
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

6 participants