-
-
Notifications
You must be signed in to change notification settings - Fork 158
Labels
bugSomething isn't workingSomething isn't working
Description
Reproduction link or steps
Hello all!
Having multiple entry points for multiple platforms...
import {defineConfig} from "tsdown";
export default defineConfig([
{
entry: "./src/index.browser.ts",
format: "esm",
exports: true,
platform: "browser",
},
{
entry: "./src/index.node.ts",
format: "cjs",
exports: true,
platform: "node",
},
]);
Run
npx tsdown --config tsdown.config.ts
What is expected?
In this case, platform specific exports declarations.
Note: does not have to produce same output (this is manual declarations predating migration to tsdown)
"exports": {
"node": {
"import": {
"types": "./dist/index.node.d.ts",
"default": "./dist/node.js"
},
"require": {
"types": "./dist/index.node.d.cts",
"default": "./dist/node.cjs"
}
},
"default": {
"import": {
"types": "./dist/index.browser.d.ts",
"default": "./dist/browser.js"
},
"require": {
"types": "./dist/index.browser.d.cts",
"default": "./dist/browser.cjs"
}
}
},
What is actually happening?
Results into malformed package.json file
{
"name": "// redacted",
"version": "// redacted",
"description": "// redacted",
"license": "UNLICENSED",
"type": "module",
"exports": {
".": "./dist/index.node.cjs",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"scripts": {
// redacted
},
"devDependencies": {
// redacted
},
"dependencies": {
// redacted
},
"peerDependencies": {
"@gohealth/analytics-events": "*"
},
"publishConfig": {
"registry": "// redacted"
},
"main": "./dist/index.node.cjs"
}
",
"module": "./dist/index.browser.js"
}
Any additional comments?
This seems to be a case where multiple entries for single platform would not be feasible - those work as expected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackPriority
None yet
Effort
None yet