dusionlike / electron-builder-encryptor

simple electron package encryption tool
MIT License
23 stars 7 forks source link

Use different files in const #4

Closed StrangerGithuber closed 1 year ago

StrangerGithuber commented 1 year ago

Hello I get these errors when I am trying to use this package:

X [ERROR] Could not resolve "./settings"

    node_modules/.electron-builder-encryptor/main.js:233:41:
      233 │ const { createSettingsWindow } = require('./settings')

X [ERROR] Could not resolve "./includes/AutoUpdate"

    node_modules/.electron-builder-encryptor/main.js:234:31:
      234 │ const { AutoUpdate } = require('./includes/AutoUpdate')
          ╵                                ~~~~~~~~~~~~~~~~~~~~~~~

X [ERROR] Could not resolve "./includes/ConfigHandle"

    node_modules/.electron-builder-encryptor/main.js:245:21:
      245 │ var config = require('./includes/ConfigHandle');

Why it is so? Thank you in advance the answers.

dusionlike commented 1 year ago

Emmm, I haven't considered this use case. Currently only one entry file is supported, and the code needs to be packaged into a Bundle using a packager. (webpack, esbuild...) 🤔Maybe I can also pack it for you before encrypting. I'll try to fix this tomorrow.

StrangerGithuber commented 1 year ago

Well no idea. I just made different js files to not having everything in one place when the app becomes big so this way I can see where are the functions which I am using. Thank you in advance if you can fix it when you will have time.

dusionlike commented 1 year ago

try v1.3.0

StrangerGithuber commented 1 year ago

Almost working perfectly. Now I get this error:

X [ERROR] Could not read from file: E:\Projectek 2022\Launcher\Launcher Electron\launcher\releasetest\app\FileFunctions.js

releasetest/app/includes/AutoUpdate.js:2:51:
  2 │ const { ReadConfig, WriteConfigDefault } = require('./FileFunctions');

And it has problem with the path of the js './FileFunctions' .

dusionlike commented 1 year ago

Almost working perfectly. Now I get this error:

X [ERROR] Could not read from file: E:\Projectek 2022\Launcher\Launcher Electron\launcher\releasetest\app\FileFunctions.js

releasetest/app/includes/AutoUpdate.js:2:51:
  2 │ const { ReadConfig, WriteConfigDefault } = require('./FileFunctions');

And it has problem with the path of the js './FileFunctions' .

try v1.3.1

StrangerGithuber commented 1 year ago

Sorry for the late answer. I worked therefore I didn't have time to test and answer. I tried now and less and less errors coming up which is good however this time I get this error:

⨯ ENOENT: no such file or directory, stat 'E:\Projectek 2022\Launcher\Launcher Electron\launcher\release\app\includes\ConfigHandle.js'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, stat 'E:\Projectek 2022\Launcher\Launcher Electron\launcher\release\app\includes\ConfigHandle.js'

If I have this in the electron-builder.json file then it has problem with the above file:

"afterPack": "node_modules/electron-builder-encryptor"

If I remove "afterPack": "node_modules/electron-builder-encryptor" then successfully building the project.

dusionlike commented 1 year ago

Sorry for the late answer. I worked therefore I didn't have time to test and answer. I tried now and less and less errors coming up which is good however this time I get this error:

⨯ ENOENT: no such file or directory, stat 'E:\Projectek 2022\Launcher\Launcher Electron\launcher\release\app\includes\ConfigHandle.js'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, stat 'E:\Projectek 2022\Launcher\Launcher Electron\launcher\release\app\includes\ConfigHandle.js'

If I have this in the electron-builder.json file then it has problem with the above file:

"afterPack": "node_modules/electron-builder-encryptor"

If I remove "afterPack": "node_modules/electron-builder-encryptor" then successfully building the project.

I can't reproduce the problem, can you provide a minimal reproduction or show your project directory structure?

StrangerGithuber commented 1 year ago

I uploaded to the github: https://github.com/StrangerGithuber/somethingtoprotect You will need to npm install later if you want to test it later to pack. I couldn't upload the node_modules folder unfortunately.

dusionlike commented 1 year ago

I uploaded to the github: https://github.com/StrangerGithuber/somethingtoprotect You will need to npm install later if you want to test it later to pack. I couldn't upload the node_modules folder unfortunately.

refer to this StrangerGithuber/somethingtoprotect#1

StrangerGithuber commented 1 year ago

Yep. It works now. Thank you for the huge help.