Reputation: 27927
When I add a *.ts file to Visual Studio 2015 and this get compiled, the *.js file isn't a code behind file of the *.ts. It just resides in the folder and it's not part of the visual studio project.
Is that by design or did I break something in my project?
If it is by design, what is the motivation behind? (If i want to have a look at the file i have to show hidden files and eventually hit the refresh button... )
Upvotes: 4
Views: 7088
Reputation: 31600
If you want to change the output folder of the .js file(s) consider adding a tsconf.json file to your source folder. That way you can configure where the outputed .js file(s) ends up.
Eg:
{
"compilerOptions": {
"target": "es5",
"out": "www/scripts/appBundle.js",
"sourceMap": true,
"removeComments": true,
"sourceRoot": "/"
}
}
The documentation for tsconfig.json can be found on github at this page.
Upvotes: 0
Reputation: 725
I don't know if this is deliberate or not.
If you want to include the JavaScript files in your project, you need to edit the project file manually. Open it up in Notepad (or your favourite text editor) and do the following;
<Content Include="Scripts\yourfile.ts" />
<Content Include="Scripts\yourfile.js">
<DependentUpon>yourfile.ts</DependentUpon>
</Content>
The JavaScript file should now get pulled in.
You'll want this is you are using Visual Studio to publish your project to deployment.
Upvotes: 3
Reputation: 250842
This is by design - the JavaScript file is a build artefact, just like a DLL.
The idea is that you check in your TypeScript code and allow the build server to create your JavaScript files. While you may be running in "Debug" mode, the build server can generate them in "Release" mode, which may have more optimisations enabled.
Upvotes: 5