From 8d33b0c4302d263f1dc5e92b0407e8ab4bd44433 Mon Sep 17 00:00:00 2001 From: Joaqim Planstedt Date: Mon, 12 Jun 2023 13:36:30 +0200 Subject: [PATCH] Update: ESbuild commonjs for browser --- .vscode/settings.json | 21 --------------------- esbuild.cjs.js | 4 +++- package.json | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 00065bb..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "licenser.customHeaderFile": "${workspaceFolder}/LICENSE.txt", - "licenser.license": "Custom", - "licenser.useSingleLineStyle": false, - "licenser.disableAutoHeaderInsertion": true, - - "typescript.format.enable": false, - "eslint.format.enable": true, - "eslint.lintTask.enable": true, - "editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll.eslint"], - "eslint.workingDirectories": [{ - "mode": "auto" - }], - "eslint.validate": ["typescript"], - "explorer.confirmDragAndDrop": false, - "editor.defaultFormatter": "rvest.vs-code-prettier-eslint", - "prettier.eslintIntegration": true, - "[typescript]": { - "editor.defaultFormatter": "rvest.vs-code-prettier-eslint", - }, -} diff --git a/esbuild.cjs.js b/esbuild.cjs.js index c462aed..68bf068 100644 --- a/esbuild.cjs.js +++ b/esbuild.cjs.js @@ -3,10 +3,12 @@ const esbuild = require("esbuild"); esbuild.buildSync({ entryPoints: ["src/index.ts"], + format: "cjs", + platform: "browser", outdir: "dist/cjs", bundle: true, sourcemap: true, minify: true, platform: "node", - target: ["node14"], + target: ["chrome58", "firefox57", "safari11"], }); diff --git a/package.json b/package.json index b76abcf..fecb965 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,21 @@ "name": "tslib-esbuild", "version": "1.0.1", "description": "", + "type": "commonjs", "exports": { - "require": "./dist/cjs/index.js", - "import": "./dist/esm/index.js" + "node": { + "require": "./dist/cjs/index.js", + "import": "./dist/esm/index.js" + }, + "default": "./dist/esm/index.js" }, "main": "./dist/cjs/index.js", "types": "./dist/cjs/index.d.ts", - "type": "commonjs", + "files": [ + "./dist/csj/index.js", + "./dist/esm/index.js", + "./dist/cjs/index.d.ts" + ], "scripts": { "ts-types:esm": " tsc -p tsconfig.json --emitDeclarationOnly --outDir dist/esm", "ts-types:cjs": " tsc -p tsconfig.cjs.json --emitDeclarationOnly --outDir dist/cjs", @@ -52,4 +60,4 @@ "engines": { "node": ">=16" } -} +} \ No newline at end of file