vendredi 27 janvier 2017

How to bundle a clientside Typescript project?

I'm currently trying to get myself some good or best practices for properly using Typescript and I'm struggling to find out how I'm supposed to create a clientside (executed in the browser) bundle of a Typescript project.

Say I have the following directory layout:

[bin]
  banana.js
[ts]
  [components]
    Bar.ts
    Foo.ts
    Moo.ts
  banana.ts
tsconfig.json

I'm using Atom with the atom-typescript extension, so there are some few specific options in the tsconfig.json, but it is downwards compatible. I'm using the default tsconfig.json provided by the extension with a few changes, namely to module, rootDir and outFile.

I've uploaded the sample to a GitHub repo: http://ift.tt/2kst4jh

The bin/banana.js has been compiled by Typescript. The bin/banana.aim.js is what I'm trying to achieve. (Just not sure about the exports.Banana =-statement; should I use exports.default =?)




Aucun commentaire:

Enregistrer un commentaire