Skip to content

Commit

Permalink
Fix the exports of vscode-languageserver-types
Browse files Browse the repository at this point in the history
The `exports` field is needed for dual publishing CJS and ESM. The
`module` field on the other hand, is a non-standard property. Some
bundlers incorrectly interpret it, causing interop issues.

An additional `package.json` file is written to mark the ESM output as
actual ESM.
  • Loading branch information
remcohaszing committed Aug 18, 2023
1 parent 7792b0b commit 4c1ce08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
},
"main": "./lib/umd/main.js",
"typings": "./lib/umd/main",
"module": "./lib/esm/main.js",
"exports": {
".": {
"import": "./lib/esm/main.js",
"default": "./lib/umd/main.js"
}
},
"scripts": {
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
"prepack": "npm run all:publish",
Expand All @@ -26,7 +31,7 @@
"all": "npm run clean && npm run compile && npm run lint && npm run test",
"compile:esm": "node ../build/bin/tsc -b ./tsconfig.esm.publish.json",
"compile:umd": "node ../build/bin/tsc -b ./tsconfig.umd.publish.json",
"all:publish": "git clean -xfd . && npm install && npm run compile:esm && npm run compile:umd && npm run lint && npm run test",
"all:publish": "git clean -xfd . && npm install && npm run compile:esm && npm run compile:umd && echo '{\"type\":\"module\"}' > lib/esm/package.json && npm run lint && npm run test",
"preversion": "npm test"
}
}

0 comments on commit 4c1ce08

Please sign in to comment.