1

In vanilla browserify you can specify "paths" option to set directories where browserify looks for "required" files.

browserify({paths: ["./source/App"]})

When using tsify to compile TypeScript, this option seems to be ignored. The reason for using paths in the first place, is to avoid having every require statement start with "../../../etc".

I know an alternative option is to place the code in node_modules, but firstly that does seem pretty odd (you wouldn't normally keep you application code with your dependencies) but it also requires you to commit node_modules to your repositories and make sure no one ever clears that directory to reinstall dependencies.

The other alternative; symlinks don't work on windows, and also seems like quite a "hacky" solution.

I am quite new to browserify (coming from RequireJS), so it is possible that I overlooked something. But at this point I really would appreciate some input. If it makes any difference I am also using gulp.

Jacob Poul Richardt
  • 3,145
  • 1
  • 26
  • 29

1 Answers1

1

Well, given that Path mappings based module resolution feature is proposed for TypeScript 1.8 and tsify is a thin wrapper of the TypeScript compiler, I can't imagine a way how it can work nowadays.

I expect that TypeScript 1.8 will be ready in a few months.

MartyIX
  • 27,828
  • 29
  • 136
  • 207
  • That is pretty cool. Though I was hoping for solution to the problem now ;) I also don't need anything as complex as that feature, I just need to set a single root/base dir. – Jacob Poul Richardt Nov 08 '15 at 00:52