Allow me to elaborate here for clarity.
TL;DR
We know there’s issues. The entire Angular community is dealing with them, not just Ionic. We’re working hard to fix them - both our code and working with library producers to make things better. We know some members of the community are struggling right now with libraries. We’re doing everything we can as fast as we can to get this situation squared away.
Gulp
If we were using gulp
, we’d still be seeing the same issues we’re seeing today. gulp
is just a task runner, so you give it a task, and it runs it. It works well - but hasn’t had a lot of updates recently and we were seeing a lot of deprecation warnings. npm scripts
enable basically the same thing without the added overhead of gulp. This allows us to reduce dependencies, speed up install time, and take one moving part out of the equation.
Where we’ve seeing issues right now really boils down to two things:
Taking the compiled JS files and bundling them into one large bundle.
When Ionic 2 first went into Beta, we used Webpack
. This drew the ire of the community because it was hard to use and configure. We made the decision to switch to Browserify
. Browserify is simpler to use than Webpack
, and works decently for the most part.
We decided to try a new tool called Rollup
for bundling with the RC release because it is proven to produce a script that the browser can process and execute faster. See this great read from Nolan Lawson on the subject. When we tested it out internally, we did not see any issues at all. Everything was working great! In our tests, Rollup apps did start up in about 1/3 of the time that a Webpack
or Browserify
app did. So that was great and very validating. This is important since we are not just web apps, we compete with and are compared to native apps on devices that boot up instantly.
However, when we released to the masses, we’ve found that this tool does not work great with many libraries Ionic developers are using. Sometimes it requires configuration to get it to work, and sometimes it just doesn’t work at all.
In the meantime, since the Ionic beta release, Webpack
has grown tremendously in popularity.
So, there’s where we’re at now. We think Rollup is the future, but we recognize that the community isn’t there yet. With that said, we are investigating in exposing Webpack
as an option to bundle apps when Rollup simply won’t work.
Hopefully this will provide a good balance to the community to build the apps they want with the tools they want. If an app uses a library that Rollup
can’t handle, they can accept the tradeoff and use the slightly slower webpack
.
Stay tuned. I hope we’ll have more to share on this topic soon. Please let me know what you all think about this.
Many popular Angular libraries are not set-up for ngc
.
ngc
, or the Angular ahead-of-time compiler is very strict. It takes Typescript
as an input, processes it, and outputs better Typescript
essentially (for component/directive/etc files). Because it is working off of Typescript, public/private must be correct on variables/properties, variables must be declared correctly ahead of time, things must be typed correctly, etc for it to work. This is a bit of a change from Angular 1 and even earlier Angular 2 development. It is way more strict - and it can be challenging. We’re confident that the Angular team will continue to iterate on this to make it easier to use and more forgiving.
We’re also finding that a lot of libraries out there are not being compiled ahead-of-time correctly, and this is breaking compatibility with apps that are compiled with ngc
. Whenever an Ionic app is run on a device, it is compiled with ngc
. Basically, they may contain the NgModule
in the lib, but they often times lack the proper AoT
metadata needed.
Basically, the community is in a transition period right now. Bear with us - developers would be seeing the same challenges with vanilla Angular 2 apps that they are with Ionic apps right now. The community will get these issues resolved. We are dedicated to helping the community get to where it needs to go to be successful. I am working on producing documentation for library authors right now on how to get their library squared away. I have seen this metadata issue with ~10 different popular Angular libraries or so in the past couple weeks since we released RC.0.
Anyway, sorry for the novel. I just wanted to give some insight into where we’re at and what we’re thinking. Of course, these are just my opinions and may not be reflective of the entire team.
Happy to discuss further, but probably later. We have a lot of work to do to get everything in great shape for the community.
Thanks,
Dan