转到主要内容
Latest blog post (July 25, 2024): npm package provenance.

How to use with pkg

The client files are not automatically included as assets, you need to manually specify them:

index.js

const{Server}=require("socket.io");

const io =newServer();

io.on("connection",(socket)=>{
// ...
});

io.listen(3000);
警告

ES modules are not currently supported. More information here: https://github.com/vercel/pkg/issues/1291

pkg.json

{
"assets":"node_modules/socket.io/client-dist/*.js"
}

And then run:

$ pkg -c pkg.json -t node14-linux index.js

And voilà!

AltStyle によって変換されたページ (->オリジナル) /