Skip to content

Dual-export ESM and CJS builds. Migrate from webpack to tsup #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. <matthew.widdi@gmail.com>",
"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": "pnpm@9.12.2"
}
Loading