简体   繁体   中英

Rollup obfuscator plugin not running

I have this config:

import ts from "@rollup/plugin-typescript";
import { uglify } from "rollup-plugin-uglify";
import obfuscator from "rollup-plugin-javascript-obfuscator";

export default {
  input: "src/index.ts",
  output: [
    {
      file: "dist/bundle.js",
      format: "cjs",
    },
    {
      file: "dist/ugly-bundle.js",
      format: "cjs",
      plugins: [uglify()],
    },
    {
      file: "dist/obfuscate-bundle.js",
      format: "cjs",
      plugins: [obfuscator({ compact: true })],
    },
  ],
  plugins: [ts()],
};

And am trying to obfuscate a my files. The problem is, All other plugins work, but obfuscator doesn't. And I have no clue why. I tried removing the {compact} options, but no difference. It just transpiles the code, so the obfuscate-bundle.js is the same as bundle.js . ugly-bundle.js is in one line, and minified.

What am I missing?

I'm using this package: https://github.com/javascript-obfuscator/rollup-plugin-javascript-obfuscator

This plugin is outdated, rollup change their function names, see this change

The "transformBundle" hook used by plugin javascript-obfuscator is deprecated. The "renderChunk" hook should be used instead.

And for install I suggest use git repo with custom name :

npm install rollup-plugin-javascript-obfuscator@scarletsky/rollup-plugin-javascript-obfuscator
//or
yarn add rollup-plugin-javascript-obfuscator@scarletsky/rollup-plugin-javascript-obfuscator

In this case you can look on network graph and try find better replacement

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM