Good day everyone.
I try to build my web project with Gulp. I want use TypeScript and I want ruling dependencies with browserify.
But I have some trouble with it.
I use next code for build:
var path = {
build: {
js: 'build/js/',
},
src: {
ts: './src/ts/*.ts',
},
};
gulp.task("ts:build", function(){
glob(path.src.ts, {}, function(err, files){
var b = browserify({
cache: {},
packageCache: {},
debug: true
});
_.forEach(files, function(file){
b.add(file);
});
b.plugin('tsify', { noImplicitAny: true })
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest(path.build.js))
});
});
});
I can't understand how I must declare dependencies. For example, I have two *.ts file: main.ts and someclass.ts. In someclass.ts I write some class:
class SomeClass {
// bla-bla-bla
}
export = SomeClass;
And I want to use this class in main.ts. I try this with browserify:
var settingsPanel = require("./someclass");
gulp build have worked correctly, but in browser console I see
node_modules\browserify\node_modules\browser-pack_prelude.js:1Uncaught Error: Cannot find module './someclass';
I will be very helpfull for any advice about this. Especially for link on some code example with gulp+browserify+typescript.