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

Compile all components to one JS file #2850

Closed
danhalliday opened this issue Jul 2, 2015 · 3 comments
Closed

Compile all components to one JS file #2850

danhalliday opened this issue Jul 2, 2015 · 3 comments

Comments

@danhalliday
Copy link

I'm trying to work out how to compile all of my TypeScript components to one JavaScript file. My app will have 50-100 components, so it's obviously not feasible to load them individually using System.import().

Concatenating compiled JavaScript files doesn't work because of the duplicate code. Concatenating the TypeScript files almost works, except for all the duplicate import symbols.

How to do this?

@pkozlowski-opensource
Copy link
Member

@danhalliday you need to chose one of the supported module formats (I would suggest System.register) when transpiling from TS->ES5 and then concatenate files. Some of the module transport formats are concatenation-friendly.

You might want to look at the setup I've got in https://github.com/pkozlowski-opensource/ng2-play to see what I mean. There are some pointers to learning materials in the repo as well.

We are going to have complete, step-by-step instructions in the future but there are few moving parts atm.

I'm going to close this one since this is a general support question. We will have detailed instructions and this stuff is being worked on, but for now you need to do some digging / experimenting, I'm afraid, as many of the tools used are in the alpha / beta / pre-release state so there are many moving parts.

@dsebastien
Copy link

You might also be interested by the following: I build in two steps: #1 transpiles TS to es5/commonjs and #2 bundles it all for production:

https://github.com/dsebastien/midnightLightV2/blob/master/gulp/tasks/scripts-typescript.js
https://github.com/dsebastien/midnightLightV2/blob/master/gulp/tasks/scripts-javascript-dist.js

I assume that when the final version of TypeScript 1.5 will be out I'll be able to switch to the System module format..

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants