Closed learncodingforweb closed 1 year ago
Protect source code, but not your resources.
How to make react app content secure by using Uglify / Obfuscator or encryption technique as you have provided provision for code protection against read for node source code not render process, which include frontend ui code like reactjs.
import { defineConfig, bytecodePlugin } from 'electron-vite'
export default defineConfig({
main: {
plugins: [bytecodePlugin()]
},
preload: {
plugins: [bytecodePlugin()]
},
renderer: {
// ...
}
})
I think obfuscation don't have much protection, you can minify(build.minify
) your code.
Haven't tried it myself but I guess you could put the sensitive part of the logic into main process (Nodejs) instead of react frontend and use bytecode plugin.
Describe the bug
Steps followed npm create @quick-start/electron, create myapp with react typescript cd myapp && npm i npm build:linux
Still able to see source code inside dist/linux-unpacked/resources/, how to enable code protection against read.
As mention in docs Compile to v8 bytecode to protect source code.
To to make sure code protection against read.
Electron-Vite Version
1.0.25
Electron Version
24.6.2
Vite Version
4.4.2
Validations