2

I opened an Angular 2 website in Visual Studio 2015 update 3 as a website project. I added the "compileOnSave": true to tsconfig.json and restarted VS. I rebuilt the project and ran it however no .js files are being created. I am using Typescript 2.0.3. I see 'BuildOnSave..' messages when I edit a .ts file.

Any ideas why Javascript files are not being created?

Update tsconfig.json:

{
    /*"compileOnSave": true,*/
    "compilerOptions": {
        "target": "es5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "watch": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false
    },
    "exclude": [
        "node_modules",
        "typings/main",
        "typings/main.d.ts"
    ]
}
3
  • It would help if you'd add your tsconfig.json to the question Commented Dec 7, 2016 at 9:40
  • this link may help you...but not sure...danielhindrikes.se/visual-studio/… Commented Dec 7, 2016 at 9:43
  • @Nitzan tsconfig.json added. Commented Dec 7, 2016 at 16:34

2 Answers 2

1

Seems like you haven't included any files to compile.
There are different ways of specifying which files the compiler needs to compile, but you haven't used any of those, you only specified what to exclude.

You can use include:

"include": [
    "src/**/*"
]

Or you can use files:

"files": [
    "file1.ts",
    ...
    "fileN.ts"
]

More on those in the tsconfig.json docs page.

You can also use the rootDir or rootDirs compiler options.

Sign up to request clarification or add additional context in comments.

4 Comments

There are many tsconfig.json files I have seen which don't include any of what you mentioned. Examples: github.com/GoshaFighten/Angular2DX/blob/master/tsconfig.json & github.com/AngularShowcase/angular2-sample-app/blob/master/…
and according to the question's answer, the compiler defaults to including all files in folders and subfolders. stackoverflow.com/questions/34117191/…
Fair enough. Have you tried compiling it yourself using tsc in the command line?
tsc works but I don't to compile manually. I think I have a solution for this by creating a project from scratch and copying files to it
1

Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc. You will need to install the TypeScript compiler either globally or in your workspace to transpile TypeScript source code to JavaScript

The easiest way to install TypeScript is through npm, the Node.js Package Manager. If you have npm installed, you can install TypeScript globally (-g) on your computer by:
npm install -g typescript

You can test your install by checking the version or help. tsc --version tsc --help

Finally make sure to click on "Show all Files" in solution explorer menu bar to see compiled JavaScript files

2 Comments

My post and the tag explicitly mention that I am using Visual Studio 2015. I am not using Visual Studio Code.
Hi Tony_Henrich, sorry for the confusion, Anyways In Visual Studio 2015, in Solution Explorer, in the menu bar we have an icon called 'Show All Files' if this button is not selected VS wont show the .ts to .js compiled files, perhaps this may help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.