Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commonjs and Webpack #19

Open
cveld opened this issue Apr 5, 2016 · 5 comments
Open

Commonjs and Webpack #19

cveld opened this issue Apr 5, 2016 · 5 comments

Comments

@cveld
Copy link

cveld commented Apr 5, 2016

Do you think it is preferable to switch over to Commonjs module code generation in combination with Webpack?

The main benefit I see is that dependencies are tracked through explicit imports within the .ts-files instead of having to wire them up manually in index.html or the tsconfig-files section to maintain execution order. Additionally, Webpack reduces configuration complexity compared to the chaining of several gulp tasks and its system also incorporates the bundling of styles and vendor assets through explicit referencing from within .ts-files.

A major downside I feel is that in the Commonjs pattern you will need to add explicit references in every .ts-file you produce.

@regevaz
Copy link

regevaz commented Aug 1, 2016

@cveld - indeed that's a good question and i've also submitted a related ticket - #24

can you elaborate what do you mean by saying: "A major downside I feel is that in the Commonjs pattern you will need to add explicit references in every .ts-file you produce."?

Thanks!

@cveld
Copy link
Author

cveld commented Aug 3, 2016

@regevaz well in c# you implicitly get references to all of the stuff in the same namespace. That's not the case with TypeScript and Webpack. Since as soon as you do not explicitly reference (using the import statement) to the ts-files you require, Webpack will not include it in the bundle and the reference will be missing.

@regevaz
Copy link

regevaz commented Aug 3, 2016

thanks for the reply.
what are the chances of implementing your request...? :)

@cveld
Copy link
Author

cveld commented Aug 3, 2016

Well I think we need to define some kind of mapping from c# assemblies and namespaces towards TypeScript's module system. Somehow I would like to build modules that consist out of multiple TypeScript files and then reference such a module with only one import directive. Maybe it's already possible if I would know how?

@regevaz
Copy link

regevaz commented Aug 4, 2016

Exactly! well, AFAIK, we should wait until Typescript will be more matured :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants