Question: Vite (Vue3) with electron - Best approach to encode?
See original GitHub issueHi Osama and thank you for this amazing project.
I am using vite which creates a static html
and js
file which I then import to electron
.
I would like to encrypt this .js
file, preferably with some automatic way while building with electron-builder
or vite’s included rollup
.
I have successfully used bytenode
for the electron .js
files but can’t figure out how to do the same for the client files.
How would you suggest is the best way to compile and load it within the html?
index.html
<html lang="en">
<head>
<link rel="stylesheet" href="/_assets/style.8c7bb816.css">
</head>
<body class="w-screen h-full min-h-screen min-w-screen font-body">
<div id="app"></div>
<script>
// I assume 'bytenode' and 'fs' will be loaded by electron's node_modules
const fs = require('fs');
const bytenode = require('bytenode');
if (!fs.existsSync('/_assets/main.jsc')) {
bytenode.compileFile('/_assets/main.js', '/_assets/main.jsc');
}
//How exactly should I load the jsc? This was loaded as a module before...
require('/_assets/main.jsc'); //<-- Example's getHTML function is not available within vue. Should I just request the jsc and only that?
</script>
<!-- <script type="module" src="/_assets/main.js"></script>-->
</body>
</html>
Unfortunately the above does not compile automatically when built with electron.
I would greatly appreciate your help. Many Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
Question: Vite (Vue3) with electron - Best approach to encode?
I am using vite which creates a static html and js file which I then import to electron . I would like to...
Read more >Building a Vue 3 Desktop App with Vite and Electron - LearnVue
In this article, we're going to be taking a look at how to Vue 3 Desktop Project from a Vite app.
Read more >How to Build an Electron App with Vue.js and Vite
Let's combine the power of Electron with Vue.js and Vite to create incredible desktop applications using nothing but JavaScript.
Read more >Vue 3 vite and electron with a local database?? : r/vuejs - Reddit
Electron Storage is a good key-value store that simply wirtes .json in the app directory, which is a safer place.
Read more >coderminer/electron-vue3-ts - GitHub
This is a secure template for electron applications. Written following the latest safety requirements, recommendations and best practices.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @OsamaAbbas for these details. I will try it with the default
electro-quick-start
example and indeed maybe my problem is withelectron-builder
. Many thanks for your help.I apologize for the late response. I will look into it today and get back to you.