question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Vite (Vue3) with electron - Best approach to encode?

See original GitHub issue

Hi 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

1reaction
cliqercommented, Aug 18, 2020

Thank you @OsamaAbbas for these details. I will try it with the default electro-quick-start example and indeed maybe my problem is with electron-builder. Many thanks for your help.

1reaction
OsamaAbbascommented, Aug 11, 2020

I apologize for the late response. I will look into it today and get back to you.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found