https://www.npmjs.com/package/pkg
新建 package.json
1 2 3 4 5 6 7 8 9 10 11 |
{ "name": "app", "version": "1.0.0", "bin": "index.js", "pkg": { "targets": [ "node16-linux-x64", "node16-macos-x64" ] } } |
执行 pkg .
就可以打包出来
刚试了效果还不错!
安全性未知,不建议把打包的代码传播到外部,
自己试试玩玩还是可以的