-
Notifications
You must be signed in to change notification settings - Fork 12.8k
outDir option does not copy the ts files #6435
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
Comments
It is not designed to copy the source files. If you want the source files available, you should do as you suggested and copy them external to the |
Here's the issue with the way typescript is working in Visual Studio 2015 right now with and without the outDir when working with ASPNET5 (sorry, core!)
Oddly, if you use gulp and use outdir instead of outDir then you get the pathing you would expect and it works normally, but then you have to use gulp to compile typescript instead of Visual Studio, and then watch for changes to .ts files to try and get it to compile on save, which is a mess and it doesn't error in a useful way (i.e. they're not in the error window) and doesn't stop execution of your app in debug when there is an error so you're wondering why your typescript changes had no effect. In short this is a mess right now that needs to be fixed because as it stands the only viable alternative is to put your typescript files in the wwwroot which is a bad solution. |
@JohnGalt1717, i d not think your commments are related to the OP. For outDir computation, if you only specify For map files, you do not need to move them along with the js files. use If you do move the map files, but now the reference to the sources files are wrong, use hope that helps. |
Here's my structure: /wwwroot/app <= this is the destination for the js and map files. (with full hierarchy of ./controllers, ./directives etc.) /scripts/ <= this is the source of the ts files. (with a full hierarchy of ./controllers, ./directives etc.) using Vs.net 2015 Update 1 with ASPNET 5 RC1 Update 1 please explain how these options can compile the .ts files from the /scripts/ folder into the /wwwroot/app folder properly with the .map files pointing to the right .ts files so that everything will work in IE and Chrome to debug into the .ts files. And note that the /scripts/*.ts files have a reference at the top that points to something in ../..//scripts/Interfaces.ts and it shouldn't be copied over at all because it's out of the project and it shouldn't effect the pathing that is created in the /wwwroot/app folder. Anyone doing strong typing from their API to their angular or other app using ts (huge win for testability and reliability by doing this so everyone should be doing this) will have a similar structure so it needs to be supported. If you use outdir instead of outDir using gulp and TSC it will compile them into the right spots and even the map files will be right. However this isn't recognized by VS.net as a valid param in the tsconfig file and thus can't be used (it just ignores it and compiles to the same directory) |
set config to be: {
"compilerOptions": {
"outDir": "./wwwroot/app", // put output in /wwwroot/app
"rootDir": "./scripts" // all inputs are under /scripts
}
}
That is the problem here. Having said that, if gulp is working fine for you, i do not see why you can not use it. TypeScript compiler is not meant to be a build system. Similarly VS is an IDE, it has build integration with MSBuild, but you can use any other build system that works for you with the Task Runner Explorer. |
This creates a folder under /wwwroot/app with the project name/src/project name/scripts/ instead of them being deployed in the /wwwroot/app folder itself. This is the issue endlessly and useing outdir instead of outDir is just a hack because it isn't even supported. Further, there is no guidance on how gulp should be setup for typescript to work properly and get compile on save, and incremental compile instead of always compile and if you setup watches it fails for bizzare reasons etc. It shouldn't be this hard to use a basic tool like typescript in aspnetcore. Hence why I went back to using msbuild and vs.net's settings for it, but then it's borked completely. The problem with using .d.ts is that it isn't just definitions and if I make it add definitions then in that project I get endless compile failures because of everything being defined twice. |
you are not using
if you use gulp/grunt/etc.. you can not use compile on save. gulp has a watch mode, and that would be my recommendation here.
I agree, and i agree the documentation is not compete here. can you share a setup that we can look at and see what issues are happening and how we can make it better, and hopefully write a sample in the process.
I think these should be compiled twice. i.e. once for your interfaces.ts and once for your other scripts, this way you have two outputs. The fix for issue #4714 should make this possible. but again, i would appreciate a repro i can look at. |
Except I did use rootDir. I copied exactly what you put in the tsconfig file and got those results. Gulp watch causes tsc to fail on compile. Hence I can't use it. here's my tsconfig.json file that is in the /scripts folder:
(this is the sort of working version. Add the outDir and rootDir as you specified) Just put any old typescript file in the scripts folder Here's my gulp: `/// var gulp = require("gulp"), var config = new Config(); var project = require("./project.json"); var environment = { paths.js = paths.webroot + "js//*.js"; gulp.task("clean:js", function (cb) { gulp.task("clean:css", function (cb) { gulp.task("clean", ["clean:js", "clean:css", "clean-ts"]); gulp.task("min:js", function () { gulp.task("min:css", function () { gulp.task("less", function () { gulp.task("html", function () { /**
/**
/**
/**
gulp.task("cleanRelease", function () { gulp.task('watchTs', function () { gulp.task("watchLess", function () { }); gulp.task("watchHtml", function () { gulp.task("min", ["min:js", "min:css"]); Run compile-ts and you'll see what it does. It goes all of the way back to the solution root folder even with rootDir specified. |
The tsconfig.json file in my project looks like below. I have outDir set to wwwroot/app. This option copies the js files and the map files. See the picture.
But this outDir option does not copy the sources (ts files from where js files are generated) to the wwwroot/app directory, so the debugging can't be done in IE or any browser.
Is this a bug, or should I set some other option to make it work? Or should I use gulp task to copy the source files?
The text was updated successfully, but these errors were encountered: