javascript-obfuscator / webpack-obfuscator

javascript-obfuscator plugin for Webpack
https://github.com/javascript-obfuscator/javascript-obfuscator
BSD 2-Clause "Simplified" License
853 stars 84 forks source link

Vue 2 webapp fails to build (Webpack) #130

Open Thomas-1985 opened 2 years ago

Thomas-1985 commented 2 years ago

Hi

Versions: "webpack-obfuscator": "^2.6.0", "@vue/cli-service": "^4.5.13", "vue": "^2.6.11",

I am trying to obfuscate my vue.js 2 webapp. My cue.config.js looks like this `const fs = require('fs')

module.exports = { chainWebpack: config => { config.module.rules.delete('eslint')

var JavaScriptObfuscator = require('webpack-obfuscator');
config.plugin('obfuscation').enforce = 'post';
config.plugin('obfuscation').use(JavaScriptObfuscator, [
  {
    compact: false,
    controlFlowFlattening: false,
    controlFlowFlatteningThreshold: 0.75,
    deadCodeInjection: false,
    deadCodeInjectionThreshold: 0.4,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: false,
    identifierNamesGenerator: 'hexadecimal',
    log: true,
    numbersToExpressions: false,
    renameGlobals: false,
    selfDefending: false,
    simplify: false,
    splitStrings: false,
    splitStringsChunkLength: 10,
    stringArray: false,
    stringArrayEncoding: ['base64'],
    stringArrayIndexShift: false,
    stringArrayRotate: false,
    stringArrayThreshold: 0.75,
    stringArrayShuffle: true,
    stringArrayWrappersCount: 2,
    stringArrayWrappersChainedCalls: true,
    stringArrayWrappersParametersMaxCount: 4,
    sourceMap: false,
    stringArrayWrappersType: 'function',
    transformObjectKeys: false,
    target: 'node',
    unicodeEscapeSequence: false
  }, []]);

}, outputDir: process.env.OUTPUT_DIR }`

I disabled all options but i cannot get it to work. As soon as i run npm run serve --open the app is compiled and the browser opens, but i get no output (i should be redirected to the login page of my app). Instead i get the attached error in my browser console

Im unsure what i am doing wrong here

js obfuscator e

vokshirg commented 2 years ago

@Thomas-1985 have you solved the problem?

Thomas-1985 commented 2 years ago

No, i have no idea how :(

Thomas-1985 commented 2 years ago

I also tried the following in my vue.config.js

const fs = require('fs')
const WebpackObfuscator = require('webpack-obfuscator');

module.exports = {
  configureWebpack: {
    plugins: [
      new WebpackObfuscator ({
        compact: true,
        rotateStringArray: true
      })
    ]
  },

  chainWebpack: config => {
    config.module.rules.delete('eslint')
  },
  outputDir: process.env.OUTPUT_DIR || '../public'
}

The result is the same, see the above screenshot

Thomas-1985 commented 2 years ago

Does somebody have a clue? I still wasn't able to fix this