Skip to content

Commit

Permalink
Merge pull request #74 from MatthewWid/cjs-esm-support
Browse files Browse the repository at this point in the history
Dual-export ESM and CJS builds. Migrate from webpack to tsup
  • Loading branch information
MatthewWid authored Oct 18, 2024
2 parents 0900911 + 76a988e commit aecaa5b
Show file tree
Hide file tree
Showing 7 changed files with 650 additions and 754 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

* Fixed default state type when creating sessions and channels with `createSession` and `createChannel` being set to `unknown` instead of `DefaultSessionState` and `DefaultChannelState`, respectively.
* Fixed package directly exporting a single object containing exports, breaking named imports when using ESModules, and instead dual-export two separate builds to support both ESM and CJS.

### Removed

Expand Down
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "better-sse",
"description": "Dead simple, dependency-less, spec-compliant server-sent events implementation for Node, written in TypeScript.",
"version": "0.13.0",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"license": "MIT",
"author": "Matthew W. <[email protected]>",
"repository": "github:MatthewWid/better-sse",
Expand All @@ -18,12 +16,21 @@
"events"
],
"scripts": {
"build": "webpack --env production",
"build": "tsup",
"test": "vitest",
"clean": "rimraf ./build",
"format": "prettier --write ./src/**/*.ts",
"lint": "eslint \"./src/**/*.ts\"",
"prepublishOnly": "npm-run-all clean format test build"
"prepublishOnly": "npm-run-all format test build"
},
"main": "./build/index.js",
"module": "./build/index.mjs",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs"
}
},
"files": [
"build",
Expand All @@ -45,13 +52,10 @@
"eventsource": "^2.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsup": "^8.3.0",
"typescript": "^5.6.3",
"vitest": "^2.1.3",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4"
"vitest": "^2.1.3"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit aecaa5b

Please sign in to comment.