mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
This change allows us to: - reduce the size of the bundle - provide an ESM bundle (for usage in <script type="module">) Related: https://github.com/socketio/socket.io-client/issues/1198
44 lines
1003 B
JavaScript
44 lines
1003 B
JavaScript
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
|
const commonjs = require("@rollup/plugin-commonjs");
|
|
const { babel } = require("@rollup/plugin-babel");
|
|
const { terser } = require("rollup-plugin-terser");
|
|
|
|
const version = require("../package.json").version;
|
|
const banner = `/*!
|
|
* Socket.IO v${version}
|
|
* (c) 2014-${new Date().getFullYear()} Guillermo Rauch
|
|
* Released under the MIT License.
|
|
*/`;
|
|
|
|
module.exports = {
|
|
input: "./build/esm/browser-entrypoint.js",
|
|
output: [
|
|
{
|
|
file: "./dist/socket.io.js",
|
|
format: "umd",
|
|
name: "io",
|
|
sourcemap: true,
|
|
banner,
|
|
},
|
|
{
|
|
file: "./dist/socket.io.min.js",
|
|
format: "umd",
|
|
name: "io",
|
|
sourcemap: true,
|
|
plugins: [terser()],
|
|
banner,
|
|
},
|
|
],
|
|
plugins: [
|
|
nodeResolve({
|
|
browser: true,
|
|
}),
|
|
commonjs(),
|
|
babel({
|
|
babelHelpers: "bundled",
|
|
presets: [["@babel/env"]],
|
|
plugins: ["@babel/plugin-transform-object-assign"],
|
|
}),
|
|
],
|
|
};
|