skip to Main Content

In NativeScript building of release apps, are there any significant differences between the minifying programs of iOS and Android? I’m seeing significant differences between the minified version of the same JS file for Android and iOS release builds, and as a result the Android JS file is not working as expected.

I ran the minified JS through js-beautify and noticed significant syntax differences between the two platforms. For example, the iOS JS combines multiple lines of code into a single statement.

2

Answers


  1. Chosen as BEST ANSWER

    Further investigation of the NativeScript source did in fact turn up that both platforms are using terser to minify the code, but there are platform-specific differences between the configuration used. Here in webpack5 configuration:

           terserOptions: {
                // @ts-ignore - https://github.com/webpack-contrib/terser-webpack-plugin/pull/463 broke the types?
                compress: {
                    collapse_vars: platform !== 'android',
                    sequences: platform !== 'android',
                    keep_infinity: true,
                    drop_console: mode === 'production',
                    global_defs: {
                        __UGLIFIED__: true,
                    },
                },
    

    I still have unanswered questions with the minified source generated between the two platforms, but since this answers my original question, I will consider this the answer.


  2. Can you show me your origin JS file?
    I think it is about differences between safari and chrome.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search