0

I have defined task in my gulp file:

gulp.task('dev:build:scripts', function () { var tsResult = tsProject.src() .pipe(sourcemaps.init()) .pipe(ts(tsProject)); }); 

Which takes all of the scripts, and creates source maps to the static/dist. My tsProject:

var tsProject = ts.createProject('tsconfig.json', { outDir: paths.dist +'/app' }); 

And my tsconfig.json

{ "compilerOptions": { "target": "es5", "module": "system", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false, "outDir": "static/dist/app" }, "exclude": [ "node_modules" ] } 

However, after the gulp runs the project, it doesnt compile the JS and doesnt create sourcemaps - it only does so, when I make a change to any ts file. How can I fix this?

1 Answer 1

2

I think you forgot to actually write your results. Try this one:

gulp.task('dev:build:scripts', () => { var tsProject = ts.createProject('tsconfig.json'); var tsResult = tsProject.src() .pipe(sourcemaps.init()) .pipe(ts(tsProject)); return tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest(paths.dist +'/app')); }); 
Sign up to request clarification or add additional context in comments.

2 Comments

that was it :) thanks! do you know if it is possible to run npm install as a gulp task?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.