Typescript internal module not recognized by VS Code

前端 未结 2 596
鱼传尺愫
鱼传尺愫 2021-01-14 19:30

I am trying to separate my typescript classes in separate files using internal modules. However, the main.ts file will not load or recognize the sub modules.

2条回答
  •  旧时难觅i
    2021-01-14 19:32

    To compile several .ts files into one big .js file using a VS Code task, you need to remove the 'args' from tasks.json and add the "out" argument to tsconfig.json

    tasks.json

    {
        "version": "0.1.0",
        "command": "tsc",
        "isShellCommand": true,
        "showOutput": "silent",
        "problemMatcher": "$tsc"
    }
    

    tsconfig.json

    {
        "compilerOptions": {
            "sourceMap":  true,
            "out": "myapp.js"
        }
    }
    

    Note: When input files are specified on the command line, tsconfig.json files are ignored.

提交回复
热议问题