microsoft / TypeScriptSamples

Community Driven Samples for TypeScript
3.19k stars 1.78k forks source link

Request a sample showing a project that targets Node and the Browser without an external bundler #156

Open breck7 opened 5 years ago

breck7 commented 5 years ago

For new samples, please provide a detailed explanation of the intended sample

It is very hard to get imports and compiling working seamlessly if you are building an app with 2 targets: primarily for the browser but can also be run headless in node(for testing). The combinatorics of number of TSC config options and ways to do imports/references/requires/exports/etc is huge.

How about a somewhat complex sample browser app that can also be run headless for testing purposes.

list of technologies or tools used

It should include 2 core TypeScript file, one small file for the browser only, and then 1 test script. It should have 1 external npm dependency that is used only when run in Node, and 1 external browser dependency only used in the browser (jquery or something like that).

It should not use webpack or any other bundler like that. Just TSC.

and an explanation of why existing samples are not sufficient and a new sample is needed.

See explanation above.