Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26053] Skip JS minify by default

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsbuild, cb-tooling, minify, titaniumlib
ReporterCreative
AssigneeChris Barber
Created2018-04-11T12:58:24.000+0000
Updated2020-03-06T21:34:40.000+0000

Description

As a developer you have the option to pass --skip-js-minify to appc ti build. I think it should be unminifed by default, and only minify for production versions. There is no real benefit besides a smaller app. The disadvantages however are: - Harder to debug your code from Titanium error messages - Slightly longer build time (havent tested how much) I suggest inverting the option to --minify to minify a development version if you want to. Not passing this option will not minify it. Production builds should have this enabled by default ofcourse.

Comments

  1. Chris Barber 2018-04-11

    The minification has little performance hit during build since we already have the parsed AST in memory. Not sure about debugging. We do not generate source maps for Ti classic apps, but I believe Alloy does. I don't know if we package source maps with production alloy apps. Neither here nor there, we should have the option to package source maps with production apps and the debugger should use them. I do believe there is a performance benefit by minifying the source code. Minified code is faster to load from flash memory and faster to parse. Back in the day on slower devices with slower flash memory, this was noticeable. I think we should leave minification enabled for non-debug device builds and distribution builds. I'd be open to disabling minification for debug device builds. On a side note, you could create a hook that disables minification for all build targets so that you never have to pass in \-\-skip\-js\-minify.
  2. Creative 2018-04-11

    yes it seems the loading time performance benefit is negligible. However I have found myself in the past with looking at minified build files trying to find an issue, where all variables were renamed to single characters etc. From a dev perspective it is very odd to do such a thing as minifying during the developer loop, hence I created this issue. I dont know the internals of flash memory storage and how exactly the javascript files are persisted on a phone, but perhaps memory has improved a lot and minification is no longer necessary.
  3. Chris Barber 2018-04-11

    The idea for minifying and encrypting device builds was to force developers to experience what their app might be like in production. Believe it or not, back in the day (and probably still today) many developers did not test their distribution builds. Since minification or some other feature could introduce issues, best to find them during device builds and not distribution builds. Despite flash memory and CPU speeds increasing, minified code will load and parse faster than non-minified code. Maybe we could expose some knobs to twiddle to not minify, but strip comments? If we exposed a setting in the tiapp.xml to disable JavaScript minification and possibly the ability to just strip comments as well as improve our debugging experince by generating and using source maps, would that solve your use case?
  4. Creative 2018-04-11

  5. Chris Barber 2018-04-11

  6. Creative 2018-04-11

    i had no clue so much work has been done already. Though it saddens me it has been initiated over 5 years ago and it looks like it is not gonna be finished soon. I can see the business perspective of this being not a priority, but for me it has always been a shortcoming of working with titanium. There is simply too much "magic" going on with titanium builds, (not to speak about the alloy layer).
  7. Rene Pot 2018-04-11

    To add to this, Studio doesn't do minify by default for all non-production builds by adding the skip-minify part.

JSON Source