Providing untranspiled code (ES6) to mobile apps?

I read this article of Phil Walton about Deploying ES2015+ Code in Production Today (https://philipwalton.com/articles/deploying-es2015-code-in-production-today/) and the gains that it provides because of less polyfills and improved perfs.

size:

  • es2015+: 80k
  • es5: 175k

parse/eval time:

  • es2015+: 172ms
  • es5: 367ms

also note, that parse/eval times vary a lot from device to device; mobile devices could be way higher.

So my question here: is it worth it and is it possible?

With the current state of Ionic’s build chain, no, not in production mode. Uglifyjs (the minifier) cannot handle anything beyond ES5.

The harmony branch of uglifyJS can handle es6+ https://github.com/mishoo/UglifyJS2/tree/harmony

Last I checked, whatever ionic-app-scripts was using couldn’t.

We’re using a custom build flow—I’m pretty sure not everyone is using ionic-app-scripts. Especially v1 users.

Therefore I gave it a shot. Currently stuck that I can’t use ‘const’ in strict mode :see_no_evil:

I would consider that a feature. I hate JavaScript’s const. It’s less than worthless, because it lulls you into a false sense of security when it doesn’t actually behave like a sane person would expect.

Of course it is a feature with strict mode.
I’m trying to get this to work to see if untranspiled code is really worth the effort for ionic apps and get some numbers out for folks who might be interested in this as well.

edit: with transform-es2015-block-scoping as babel plugin it works. when I get time I’ll crunch out some numbers :v: