镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

@vilicvane

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.

Activity

  1. Seikho commented on May 27, 2016

    @Seikho

    Possibly related to microsoft/vscode#6719 ?

  2. mhegazy commented on Jun 7, 2016

    @mhegazy
    Contributor
  3. zhengbli commented on Jun 8, 2016

    @zhengbli

    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.

  4. added
    ExternalRelates to another program, environment, or user action which we cannot control.
    on Jun 8, 2016
  5. Seikho commented on Jun 9, 2016

    @Seikho

    The regression occurs in the cd1af12 commit.

  6. Seikho commented on Jun 9, 2016

    @Seikho

    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.

  7. yortus commented on Jun 9, 2016

    @yortus
    Contributor

    Evidence that Carl (@Seikho) has identified the problem.

  8. Seikho commented on Jun 9, 2016

    @Seikho

    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'
    >
    
  9. yortus commented on Jun 9, 2016

    @yortus
    Contributor

    Zhengbo Li (@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)

  10. dbaeumer commented on Jun 9, 2016

    @dbaeumer
    Member

    Important observations from microsoft/vscode#6719:

  11. removed
    ExternalRelates to another program, environment, or user action which we cannot control.
    on Jun 10, 2016
  12. zhengbli commented on Jun 10, 2016

    @zhengbli

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

  13. dbaeumer commented on Jun 13, 2016

    @dbaeumer
    Member

    Zhengbo Li (@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

  14. yortus commented on Jun 13, 2016

    @yortus
    Contributor

    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.

  15. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions