Skip to content

Commit 0661564

Browse files
chore: migrate to rollup
This change allows us to: - reduce the size of the bundle - provide an ESM bundle (for usage in <script type="module">) Related: #1198
1 parent 16b6569 commit 0661564

6 files changed

+352
-1
lines changed

lib/browser-entrypoint.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { io } from "./index.js";
2+
3+
export default io;

package-lock.json

+251
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"@babel/core": "^7.15.0",
4242
"@babel/plugin-transform-object-assign": "^7.14.5",
4343
"@babel/preset-env": "^7.15.0",
44+
"@rollup/plugin-alias": "^3.1.5",
45+
"@rollup/plugin-babel": "^5.3.0",
46+
"@rollup/plugin-commonjs": "^21.0.0",
47+
"@rollup/plugin-node-resolve": "^13.0.5",
4448
"@sinonjs/fake-timers": "^7.1.2",
4549
"@types/mocha": "^9.0.0",
4650
"@types/node": "^16.7.6",
@@ -55,6 +59,8 @@
5559
"mocha": "^3.3.0",
5660
"prettier": "^2.3.2",
5761
"rimraf": "^3.0.2",
62+
"rollup": "^2.58.0",
63+
"rollup-plugin-terser": "^7.0.2",
5864
"socket.io": "3.0.0",
5965
"socket.io-browsers": "^1.0.0",
6066
"socket.io-msgpack-parser": "^3.0.0",
@@ -76,7 +82,7 @@
7682
"test:node": "mocha --require ts-node/register --reporter dot --require test/support/server.js test/index.js",
7783
"test:browser": "zuul test/index.js",
7884
"test:types": "tsd",
79-
"build": "npm run compile && webpack --config ./support/webpack.config.js --config ./support/prod.config.js --config ./support/msgpack-parser.config.js",
85+
"build": "rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js && rollup -c support/rollup.config.umd.msgpack.js",
8086
"format:check": "prettier --check \"lib/**/*.ts\" \"test/**/*.js\" \"test/**/*.ts\" \"support/**/*.js\"",
8187
"format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.js\" \"test/**/*.ts\" \"support/**/*.js\"",
8288
"prepack": "npm run compile"

0 commit comments

Comments
 (0)