From 2ac66891b90a826c899ac6e84fd7138ce495700f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 16 Jun 2023 16:50:07 +0200 Subject: [PATCH] made node-logger CJS only, prebundle everything, treeshake CJS output as well --- code/lib/node-logger/package.json | 15 +++++++-------- scripts/prepare/bundle.ts | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/lib/node-logger/package.json b/code/lib/node-logger/package.json index 37adf9313214..234116708d7f 100644 --- a/code/lib/node-logger/package.json +++ b/code/lib/node-logger/package.json @@ -24,13 +24,11 @@ ".": { "types": "./dist/index.d.ts", "node": "./dist/index.js", - "require": "./dist/index.js", - "import": "./dist/index.mjs" + "require": "./dist/index.js" }, "./package.json": "./package.json" }, "main": "dist/index.js", - "module": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/**/*", @@ -42,14 +40,12 @@ "check": "../../../scripts/node_modules/.bin/tsc --noEmit", "prep": "../../../scripts/prepare/bundle.ts" }, - "dependencies": { + "devDependencies": { "@types/npmlog": "^4.1.2", + "@types/pretty-hrtime": "^1.0.0", "chalk": "^4.1.0", "npmlog": "^5.0.1", - "pretty-hrtime": "^1.0.3" - }, - "devDependencies": { - "@types/pretty-hrtime": "^1.0.0", + "pretty-hrtime": "^1.0.3", "typescript": "~4.9.3" }, "publishConfig": { @@ -58,6 +54,9 @@ "bundler": { "entries": [ "./src/index.ts" + ], + "formats": [ + "cjs" ] }, "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16" diff --git a/scripts/prepare/bundle.ts b/scripts/prepare/bundle.ts index 401cb756862a..885b7536a147 100755 --- a/scripts/prepare/bundle.ts +++ b/scripts/prepare/bundle.ts @@ -116,6 +116,8 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { tasks.push( build({ silent: true, + treeshake: true, + splitting: true, entry: allEntries, watch, outDir,