Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

javascript - Webpack Obfuscator not working in next.js app

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:UsersxDocumentsx
enderer.nextstaticchunkswebpack-95c2b224bccf352ee870.js' -> 'C:UsersxDocumentsxapp\_nextstaticchunkswebpack-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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...