typescript - How to bundle both js & ts files at the same time using gulp browserify? -


i got small javascript file (common.js) needs bundled compiled typescript files using gulp browserify.
shall specify common.js in gulpfile.js?

currently gulpfile.js below:

var gulp        = require("gulp"); var browserify  = require("browserify"); var source      = require('vinyl-source-stream'); var tsify       = require("tsify"); gulp.task("ut", function () {     return browserify({         basedir: "./",         debug: true,         entries: "./src/main.ts",         cache: {},         packagecache: {}     })     .external("jquery")     .plugin(tsify)     .bundle()     .pipe(source("./dist/bundle.js"))     .pipe(gulp.dest(env.gulp.browserify.outdir)); }); 

main.ts

import { sayhello } "./component/greet"; import { showhello } "./component/greet";  showhello("greeting", "unit test source code"); 

this simplest solution add common.js file browserify's entries option:

return browserify({     basedir: "./",     debug: true,     entries: [         "./some/path/common.js",         "./src/main.ts"     ],     cache: {},     packagecache: {} }) 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -