From 721895bdec6ff3c0ab2debd10ccdf0a61bd9656d Mon Sep 17 00:00:00 2001 From: Favour Date: Fri, 14 Jun 2024 16:46:02 +0100 Subject: [PATCH] chore: update bundling step to reduce package size and bump package version --- package.json | 16 ++++++++-------- rollup.config.js | 31 +++++++++++++++---------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index ca9c4ee..7ad4d19 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@bolajiolajide/now-playing", - "version": "0.0.12", + "version": "0.0.13", "description": "", - "main": "dist/now-playing.cjs.js", - "module": "dist/now-playing.esm.js", + "main": "dist/now-playing.mjs", + "module": "dist/now-playing.mjs", "types": "dist/now-playing.d.ts", "type": "module", "scripts": { @@ -11,19 +11,19 @@ "build": "npx rimraf dist && rollup --config" }, "exports": { - "require": "./dist/now-playing.cjs.js", "types": "./dist/now-playing.d.ts", - "default": "./dist/now-playing.esm.js" + "default": "./dist/now-playing.mjs" }, "files": [ - "dist" + "dist/now-playing.mjs", + "dist/now-playing.d.ts" ], "keywords": [], "author": "", "license": "ISC", "dependencies": { - "@types/node-fetch": "^2.6.11", - "node-fetch": "^3.3.2", + "@types/node-fetch": "2.6.11", + "node-fetch": "2.6.1", "zod": "3.23.8" }, "devDependencies": { diff --git a/rollup.config.js b/rollup.config.js index a036faf..10a807e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,21 +4,20 @@ import dts from "rollup-plugin-dts"; const config = [ { input: "./src/index.ts", - output: { - file: "dist/now-playing.cjs.js", - format: "cjs", - sourcemap: true, - }, - external: ["zod", "node-fetch"], - plugins: [typescript()], - }, - { - input: "./src/index.ts", - output: { - file: "dist/now-playing.esm.js", - format: "es", - sourcemap: true, - }, + output: [ + { + file: "dist/now-playing.mjs", + format: "esm", + sourcemap: true, + name: "NowPlaying", + }, + { + file: "./dist/now-playing.js", + format: "umd", + sourcemap: true, + name: "NowPlaying", + }, + ], external: ["zod", "node-fetch"], plugins: [typescript()], }, @@ -26,7 +25,7 @@ const config = [ input: "./src/index.ts", output: { file: "dist/now-playing.d.ts", - format: "es", + format: "esm", }, plugins: [dts()], },