0

Does anyone know how to get grunt-uglify-contrib to coordinate symbol mangling between output files?

We have a rather large project and break up our uglified files into 2 or more files.

An example Gruntfile uglify task of ours looks like:

uglify: {
    app: {
        options: {
            compress: false,
            //mangle: true,
            mangle: {
                toplevel: true,
                except: ['dog', 'cat', 'fish'],
                eval: true

            },
            preserveComments: false,
            sourceMap: false,
            beautify: true
        },
        files: [
            {
                src: [
                    'src/dog.js',
                    'src/cat.js',
                ],
                dest: 'dist/base_app.js'
            },
            {
                src: [
                    'src/fish.js',
                ],
                dest: 'dist/main_app.js'
            }
        ]
    }
}

We want toplevel symbol mangling. But the problem is main_app.js cannot see base_app.js's symbols.

This all works of course if we build it into a single JS file, but that doesn't work well for us.

Any tips on how to get uglify to store the mangled symbol map created while uglifying base_app.js and reuse/reapply the same symbols for main_app.js?

Thanks!

lostdorje
  • 6,150
  • 9
  • 44
  • 86

1 Answers1

0

JScrambler has good support for Project symbol mangling. https://jscrambler.com/en/help/javascript_obfuscation/renaming

It has a grunt package as well: https://www.npmjs.com/package/grunt-jscrambler

Carl Rck
  • 311
  • 1
  • 7