Skip to content

Commit

Permalink
feat: support esm (#38)
Browse files Browse the repository at this point in the history
* feat: enable esm imports

* expose esm build of headers-polyfill
  • Loading branch information
mattcosta7 authored Sep 15, 2022
1 parent bdda2fe commit 83126f6
Show file tree
Hide file tree
Showing 4 changed files with 1,176 additions and 759 deletions.
6 changes: 6 additions & 0 deletions esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"main": "../lib/esm/index.js",
"module": "../lib/esm/index.js",
"types": "../lib/index.d.ts"
}

18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
"name": "headers-polyfill",
"version": "3.0.10",
"description": "A native \"Headers\" class polyfill.",
"main": "lib/index.js",
"types": "lib",
"main": "./lib/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.js",
"default": "./lib/esm/index.js"
}
},
"repository": "https://github.com/mswjs/headers-polyfill",
"author": "Artem Zakharchenko",
"license": "MIT",
"scripts": {
"start": "tsup --watch",
"clean": "rimraf lib",
"build": "yarn clean && tsc --build",
"build": "yarn clean && tsup",
"test": "jest",
"release": "release publish",
"prepublishOnly": "yarn test && yarn build"
Expand All @@ -25,6 +34,7 @@
"jest-environment-jsdom": "^28.1.2",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.5",
"tsup": "^6.2.3",
"typescript": "4.3.2"
}
}
}
16 changes: 16 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from 'tsup'

export default defineConfig([
{
name: 'main',
entry: ['./src/index.ts'],
outDir: './lib',
format: ['esm','cjs'],
legacyOutput: true,
sourcemap: true,
clean: true,
bundle: true,
splitting: false,
dts: true,
}
])
Loading

0 comments on commit 83126f6

Please sign in to comment.