TypeScript Obfuscation

后端 未结 3 1677
感情败类
感情败类 2021-02-12 12:52

Are there any tools or forks of TypeScript to support public namespace obfuscation? I.e. to turn:

class MyUtil {
   print(): void { ... }
}

Int

相关标签:
3条回答
  • 2021-02-12 13:23

    I had the exact same question, and it was instantly deleted by SO.

    https://github.com/angular/ts-minify

    This is exactly the tool you (and I) are looking for, it seems to work pretty well, I needed to comment out a few parts where the the author was taking precautions I don't think are applicable.

    0 讨论(0)
  • 2021-02-12 13:23

    I don't believe there is any reason to do this in TypeScript. You can instead use something like Closure Compiler to do the obfuscation on your JavaScript output. Specifically look into Closure's Advanced Compilation settings.

    0 讨论(0)
  • 2021-02-12 13:27

     Not a direct answer! Js obfuscator

    https://github.com/javascript-obfuscator/javascript-obfuscator

    Plugins:

    Webpack plugin: webpack-obfuscator
    Webpack loader: obfuscator-loader
    Gulp: gulp-javascript-obfuscator
    Grunt: grunt-contrib-obfuscator
    Rollup: rollup-plugin-javascript-obfuscator
    

    NOTE:

    Only obfuscate the code that belongs to you.

    It is not recommended to obfuscate vendor scripts and polyfills, since the obfuscated code is 15-80% slower (depends on options) and the files are significantly larger.

    0 讨论(0)
提交回复
热议问题