From f3990ec5e34477d2fc21644c91a64d7a0bc004c1 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Wed, 23 Jun 2021 16:40:45 -0400 Subject: [PATCH] Add Package Exports configuration (#139) * Add Package Exports configuration (semver major) * Update compressed-size.yml --- .github/workflows/compressed-size.yml | 2 ++ package.json | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index 958fd22..45cad2f 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -8,3 +8,5 @@ jobs: steps: - uses: actions/checkout@v2 - uses: preactjs/compressed-size-action@v2 + with: + pattern: "./dist/*.{js,mjs,cjs}" diff --git a/package.json b/package.json index 666ffe7..767bbca 100644 --- a/package.json +++ b/package.json @@ -2,20 +2,24 @@ "name": "mitt", "version": "2.1.0", "description": "Tiny 200b functional Event Emitter / pubsub.", - "jsnext:main": "dist/mitt.es.js", - "source": "src/index.ts", - "module": "dist/mitt.es.js", - "esmodules": "dist/mitt.modern.js", + "module": "dist/mitt.mjs", "main": "dist/mitt.js", + "jsnext:main": "dist/mitt.mjs", "umd:main": "dist/mitt.umd.js", + "source": "src/index.ts", "typings": "index.d.ts", + "exports": { + "import": "./dist/mitt.mjs", + "require": "./dist/mitt.js", + "default": "./dist/mitt.mjs" + }, "scripts": { "test": "npm-run-all --silent typecheck lint mocha test-types", "mocha": "mocha test", "test-types": "tsc test/test-types-compilation.ts --noEmit --strict", "lint": "eslint src test --ext ts --ext js", "typecheck": "tsc --noEmit", - "bundle": "microbundle", + "bundle": "microbundle -f es,cjs,umd", "build": "npm-run-all --silent clean -p bundle -s docs", "clean": "rimraf dist", "docs": "documentation readme src/index.ts --section API -q --parse-extension ts",