docs(examples): add server bundling example with rollup

Related: https://github.com/socketio/socket.io/issues/4329
This commit is contained in:
Damien Arrachequesne
2022-04-11 07:56:28 +02:00
parent 1f03a44d1f
commit 06e6838b18
4 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1 @@
bundle.js

View File

@@ -0,0 +1,3 @@
import { Server } from "socket.io";
new Server(0);

View File

@@ -0,0 +1,19 @@
{
"name": "rollup-server-bundle",
"version": "0.0.1",
"description": "",
"main": "index.js",
"type": "module",
"author": "Damien Arrachequesne <damien.arrachequesne@gmail.com>",
"license": "ISC",
"scripts": {
"build": "rollup --config rollup.config.js"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"rollup": "^2.70.1",
"socket.io": "^4.4.1"
}
}

View File

@@ -0,0 +1,12 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
export default {
input: "index.js",
output: {
file: "bundle.js",
format: "esm",
},
plugins: [resolve(), commonjs(), json({ compact: true })],
};