一直想实现打包的功能
终于网上有个靠谱的链接了:https://www.jianshu.com/p/02a6e99d7b94
but 按照文档进行总是出现不能正常运行!!!
终于还是解决问题了,感谢:MrSmallLiu/pkg-egg-example 的作者的帮助!
环境:win10 ,node 8.16.1,npm-pkg 6.4.1 打包成 exe
1.上面链接基本上都可以完成打包exe
可能问题a:
console.log(__dirname) //打印所在的snapshot路径,生产环境可以删除 require(__dirname + ‘/node_modules/egg-scripts/bin/egg-scripts.js‘)
egg-demo.exe start D:\snapshot\src --port=7001 --title=egg-demo
"scripts": [ "./app/router.js", "./app.js", "./agent.js", "./package.json", "./config/**/*", "./app/controller/**/*", "./app/extend/**/*", "./app/schedule/**/*", "./app/service/**/*" ], "assets": [ "./app/view/**/*", "./app/public/**/*", "./static/**/*", "./node_modules/**/*" ]
console.log(‘basedir:‘,appInfo.baseDir)//虚拟文件夹下的路径 console.log(‘cur cwd:‘,curdir) //当前运行文件路径 需要写入的文件 使用此路径 如日志 //如: config.rundir =process.cwd()+ ‘/run‘;
原文:https://www.cnblogs.com/WindWall/p/windwall.html