Webpack Obfuscator not working in next.js app

Viewed 1238

How do I obfuscate my next.js app?

I've built it in the nextron framework.

This is my next.config.js:

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

module.exports = {
    webpack: (config, { dev, isServer }) => {
        config.target = 'electron-renderer';

        if (!dev) {
            config.plugins.push(
                new WebpackObfuscator({
                    controlFlowFlattening: true,
                    controlFlowFlatteningThreshold: 0.5,
                    deadCodeInjection: true,
                    debugProtection: true,
                    identifierNamesGenerator: 'mangled',
                    selfDefending: true,
                    stringArrayEncoding: true,
                }),
            );
        }

        return config;
    },
};

When I run yarn build, I get:

[Error: UNKNOWN: unknown error, copyfile 'C:\Users\x\Documents\x\renderer\.next\static\chunks\webpack-95c2b224bccf352ee870.js' -> 'C:\Users\x\Documents\x\app\_next\static\chunks\webpack-95c2b224bccf352ee870.js'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'copyfile',
  path: 'C:\\Users\\x\\Documents\\x\\renderer\\.next\\static\\chunks\\webpack-95c2b224bccf352ee870.js',
  dest: 'C:\\Users\\x\\Documents\\x\\app\\_next\\static\\chunks\\webpack-95c2b224bccf352ee870.js'
}

The version of Webpack Obfuscator is ^0.28.2. I don't really know how next works so if anyone can help me with this, that would be great.

0 Answers
Related