V
V
Valery Chupurnov2017-04-24 12:09:12
JavaScript
Valery Chupurnov, 2017-04-24 12:09:12

How to use modules in TypeScript without a module management system?

Hello. There is some project which I rewrote on TypeScript. Divided everything into import / export files
In fact, now there is only one entry point. typescript allows you to convert all this into a SystemJS or AMD modular system. But this is too much logic in my opinion. I collect the whole bundle in one file, and all the modules are in it.
In theory, there is no special logic there, load everything into a hash and use it as needed.
Webpack + babel has such an opportunity - not to use any system, but to use their own linker.
The Internet offers absolutely terrible things like browserfy or typescrpt + babel.
Isn't there an easier way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sasha, 2017-04-24
@madmages

no.

K
Konstantin Kitmanov, 2017-04-24
@k12th

And what for then modules in general, if they are not used? Remove and collect everything with gulp-concat, it's a lot of fun to manually determine the order of loading files and constantly add and remove files in the list manually :)
TypeScript, unfortunately or fortunately, does not know how to compile the application into one file - relying on third solutions, of which there are many and which represent other goodies.
> Webpack + babel has the ability to not use any system, but use their own linker.
Babel has nothing to do with it at all, it also does not know how to glue files together. But in webpack there is no such “opportunity”, it uses already existing module formats - amd, cjs and es6 are supported out of the box ( import/exportandimport()). I advise you to take a closer look, although it is a headache at first, it is generally worth it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question