Typescript - Composing dependent js files

I am having problems with the typescript compiler and external js libraries that use the corresponding definition files .d.ts

.

The problem is that they need to be referenced in the html code. With many nested libraries this becomes a problem and I'm not sure how to solve it.

eg. I have external modules:

  • Module 1 (js) - no dependencies
  • Module 2 (ts) - depends on module 1
  • Module 3 (ts) - depends on module 2
  • Application (ts) - module dependent 3

In my html, because Module 1 is JavaScript, although it has a definition file, I have to add:

<script src="Module1.min.js"></script>

      

Anyway, since this is easily removed with over 50+ tags script

that need to be changed regularly as dependencies change inside modules.

+3


source to share


2 answers


Have a look at System.js, it will load all required modules for you



0


source


Anyway, since this is easily stripped with 50+ script tags that need to be changed regularly as dependencies change inside modules.

Use an external module system. Manually managing them is a nightmare: https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md



Recommend using --module commonjs

from http://webpack.github.io/

0


source







All Articles