You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Below is the procedure I used. If anyone knows a smoother flow please comment. Special thanks to the Jef for sharing your hard work!
Convert Typescript project to Windows EXE:
OVERVIEW:
DETAILED PROCEDURE:
(1) Download node.js // javascript/typescript compiler
https://nodejs.org/en/download // get latest Node.js 'msi' installer here (prefer lts edition)
(2) OPTIONAL: Clone a Win8.1 or higher VM // needed to install nodejs
(3) Run the nodejs installer and follow the prompts (accept defaults)
I did NOT check the box to install other tools
(4) Download Latest zap2it from here:
https://github.com/jef/zap2xml
(5) Compile Typescript to Javascript:
c:> cd zap2xml top level folder
c:> npm install // runs fast with no problems
c:> npm run build
RESULT: index.js // this is a javascript file. Its placed in "dist" folder
(6) Bundle javascript and dependencies into .js using webpack:
c:> npm install webpack webpack-cli typescript ts-loader --save-dev // installs fast with no issues
https://stackoverflow.com/questions/78233280/how-do-i-convert-a-typescript-nodejs-project-into-a-single-executable-exe
// webpack.config.cjs
const path = require('path');
module.exports = {
mode: 'production',
entry: './index.js', // Entry point of application
target: 'node',
module: {
rules: [
{
test: /.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
}
};
c:> npx webpack // create bundled js output
./dist/bundle.js // a small 6K file.
(5) Install "pkg"
c:> npm install -g pkg // runs fast. no issues
(6) convert to exe using "pkg"
c:> pkg -t node18-win-x64 bundle.js
Result:
[email protected]
Output: ./bundle.exe // <<-- worked. About 36MB
RUN ON WINDOWS 7: This will run fine on windows 7 but you need to set an environ var first:
c:>set NODE_SKIP_PLATFORM_CHECK=1
c:>run the exe
Beta Was this translation helpful? Give feedback.
All reactions