-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Typescript compile to single file #6257
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Unfortunately, |
actually in #5090 we've added support for bunding amd\system modules into one file. Can you give a try to |
Thanks for the correction @vladima, I didn't realize. |
Please consider adding native bundling support to typescript. The workaround is a huge pain to setup and maintain: Compile all typescript modules to ES6, then transpile to ES5 with Babel using the correct babelrc, presets, etc; then feed the ES5 output to webpack (webpack 1.x doesn't support ES6) |
@AlexGalays can you elaborate on why you need the babel step there? i understand the webpack step. |
@mhegazy Good question... I had a few modules that required commonJS interop and that used to work with babel 5; now I moved to babel 6 and updated these modules anyway, so I'm going to fork my setup, remove the babel step and keep you updated. Edit: It indeed works just fine without babel... and it's 3 times faster now, a welcomed change. Cheers. |
I'm a bit confused. Should not compiling multiple files in I'm using gulp.task('compile', function() {
var tsProject = $.typescript.createProject('tsconfig.json', {
removeComments: true,
module: 'amd',
out: compiled.js`
});
var tsResult = gulp.src(['src/client/feature1/**/*.ts', 'src/types/**/*.ts'])
.pipe($.typescript(tsProject));
return tsResult.js
.pipe(gulp.dest('build/client/feature1.js'));
}); Given that folder define("client/feature1/a", ["require", "exports"], function (require, exports) {
"use strict";
// feature one/a code...
});
define("client/feature1/b", ["require", "exports"], function (require, exports) {
"use strict";
// feature one/b code...
}); ... which to my understanding is not valid anyway. Shouldn't output be something like this: define(["require", "exports"], function (require, exports) {
"use strict";
// feature one/a code...
// feature one/b code...
}); |
why is not it valid? |
docs for requirejs state:
|
thanks for the right pointer. |
After searching for days on how to do this, and being directed here, I also support this motion. A single export file would be great, I don't mind managing my other build steps with bash. |
+1 |
I can't be the only thinking wtf, but then again this is Microsoft, so not all that shocked |
At the moment I have a happy truce by using webpack + https://github.com/s-panferov/awesome-typescript-loader |
That loader uses tsc bare metal commands. |
I'm using TS 1.7 and I'm trying to compile my project to one big file that I will be able to include in my html file.
My project structure looks like this:
my tsconfig file is:
When I build my project I expect the build.js file to be one big file compiled from my source. But ths build.js file is empty and I get all of my files compiled o js files.
Each of my TS files look a bit like this
What am I doing wrong ?
The text was updated successfully, but these errors were encountered: