Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition to Single Execution Applications - Extension of PR #13 #14

Merged
merged 22 commits into from
Jul 26, 2024

Conversation

AngaBlue
Copy link
Owner

Extension of #13

@AngaBlue
Copy link
Owner Author

I'm currently testing with a wider set of my personal applications to see the differences and iron out any issues. Will let you know how it goes. Haven't made many changes to your original work either, just some style and docs. I may add a short disclaimer to the README given that this package will only work for new versions of Node now.

@AngaBlue
Copy link
Owner Author

AngaBlue commented Jul 25, 2024

Alright, having a look there's a few things that need work.

The first is that given an entry point, the current build system will only include that entry file. For ease of use, I think that this bundling should be included and I have previously used ncc for this purpose (another Vercel solution, hopefully this one isn't deprecated any time soon) which supports both TS & JS. However, this yields a warning (which from my testing can be safely ignored for the moment), which I'm unsure as to how to suppress.

(node:16400) Warning: Currently the require() provided to the main script embedded into single-executable applications only supports loading built-in modules.
To load a module from disk after the single executable application is launched, use require("module").createRequire().
Support for bundled module loading or virtual file systems are under discussions in https://github.com/nodejs/single-executable
(Use `My Cool App --trace-warnings ...` to show where the warning was created)

The second issue is that now the compiled code is viewable as plain text, simply by opening the compiled executable in notepad. Source code obfuscation is a feature of this module and it's something I'd like to keep. This is explored in an issue under the single executable application repo, with the solution offered being to use bytenode. I am yet to try this, however some users suggest there may be issues with requires.

@AngaBlue
Copy link
Owner Author

In this current stage I've implemented bundling - yet to play around/research what would be the best target version for the lowest supported version of Node for this module (I believe technically SEA is supported prior to Node 21, but I'm not sure to what extent). The minification doesn't do a bad job and obfuscating code, but strings are still plainly visible, bytecode or some other less reversible process would be ideal.

The require() warning still is present.

@AngaBlue
Copy link
Owner Author

I've suppressed the warnings (for some reason they are emitted as errors which made them incredibly difficult to track down...).

The source code is still only minified, not properly obfuscated.

@AngaBlue AngaBlue merged commit 98930d4 into main Jul 26, 2024
2 checks passed
@AngaBlue AngaBlue deleted the koga73-main branch July 27, 2024 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants