6

I am planning to do a little multiplayer javascript game with a node.js server (using socket.io) and would like to share some code (mostly classes) between the webclient and the server. So I found this:

How can I share code between Node.js and the browser?

However I would also like to use Typescript and was wondering how to set it up? What tsconfig.json settings are best suited for this? Do I have to use something like browserify or webpack?

Community
  • 1
  • 1
tim-we
  • 1,219
  • 10
  • 16

1 Answers1

3

Do I have to use something like browserify or webpack?

Yes. I use webpack.

What tsconfig.json settings are best suited for this

just use commonjs everywhere.

More

here is a project in typescript with both backend / frontend .... uses webpack ... and has a single tsconfig.json : https://github.com/alm-tools/alm

basarat
  • 261,912
  • 58
  • 460
  • 511
  • 1
    ... or use SystemJS: http://stackoverflow.com/questions/37989847/if-a-module-exported-as-node-js-export-module-can-we-import-it-using-systemjs-im/37994588#37994588 – Paleo Jul 01 '16 at 08:40