Skip to content

Commit

Permalink
docs(examples): add server bundling example with rollup
Browse files Browse the repository at this point in the history
Related: #4329
  • Loading branch information
darrachequesne committed Apr 22, 2022
1 parent 1f03a44 commit 06e6838
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/rollup-server-bundle/.gitignore
@@ -0,0 +1 @@
bundle.js
3 changes: 3 additions & 0 deletions examples/rollup-server-bundle/index.js
@@ -0,0 +1,3 @@
import { Server } from "socket.io";

new Server(0);
19 changes: 19 additions & 0 deletions examples/rollup-server-bundle/package.json
@@ -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"
}
}
12 changes: 12 additions & 0 deletions examples/rollup-server-bundle/rollup.config.js
@@ -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 })],
};

0 comments on commit 06e6838

Please sign in to comment.