Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

Ok I am beginning to get involved with TypeScript and I have a general question I could use some assistance on. I want to use TypeScript with Angular JS and I want to control these items with gulp build tasks. My ultimate goal would be to get all my transpiled TypeScript concatenated in a file with the angular lib (so one JS file to serve to users). However, I want the sourcemaps to work correctly and link back to the .ts files not the transpiled javascript. I got it working but the sourcemaps linked back to the transpiled JS not the typescript. Is there a way to do this? I only see folks referencing angular in a separate script tag on the web. In addition, how do the typing files factor into this? While of lesser importance to me I would think the .d.ts files for angular should be part of my gulp build process in order to debug angular JS from TS files? Again I don't necessarily care too much about this as I don't anticipate debugguing angular code but who knows. If it helps any I have experimented with the following npm gulp plugins: gulp-concat, gulp-typescript, gulp-sourcemaps.

I have tried something like the following:

var config = {
    bowerDir: __dirname + '/bower_components',
    applicationDir: __dirname + '/app',
    stylesDir: __dirname + '/styles',
    publicDir: __dirname + '/public'
};

gulp.task('compile-js', function() {
    var bundler = browserify({
            basedir: config.applicationDir,
            debug: true
        })
        .add(config.applicationDir + '/index.ts')
        .plugin(tsify)
        .transform(debowerify);

    return bundler.bundle()
        .pipe(exorcist(config.publicDir + '/application.js.map'))
        .pipe(source('application.js'))
        .pipe(gulp.dest(config.publicDir));
});

I found this here http://www.davidkudera.com/2015/02/28/typescript-gulp-bower-browserify/

Just one problem with the above, when I try to require the Angular module in index.ts the gulp task errors out saying it cannot find that module. Any thoughts?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.