From ea9a2f6fa13e9fc48f541039b7fa8218b9bff19b Mon Sep 17 00:00:00 2001 From: lajbel Date: Mon, 12 Aug 2024 11:24:30 -0300 Subject: [PATCH] feat: cjs --- package.json | 12 ++++++++++-- scripts/build.ts | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2c47ad4..954c34f 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@kaplayjs/crew", "description": "The home of the KAPLAY assets.", - "version": "1.0.1", + "version": "1.0.2", "type": "module", - "main": "./dist/index.mjs", + "main": "./dist/index.cjs", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "exports": { @@ -11,6 +11,10 @@ "import": { "default": "./dist/index.mjs", "types": "./dist/index.d.ts" + }, + "require": { + "default": "./dist/index.cjs", + "types": "./dist/index.d.ts" } } }, @@ -18,6 +22,10 @@ "type": "git", "url": "git+https://github.com/kaplayjs/crew.git" }, + "files": [ + "dist/", + "README.md" + ], "scripts": { "build": "pnpm run tsc && node --experimental-strip-types scripts/build.ts", "tsc": "tsc", diff --git a/scripts/build.ts b/scripts/build.ts index 7a1cc77..c861e5e 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -9,3 +9,13 @@ buildSync({ ".png": "dataurl", }, }); + +buildSync({ + format: "cjs", + entryPoints: ["src/index.ts"], + bundle: true, + outfile: "dist/index.cjs", + loader: { + ".png": "dataurl", + }, +});