Skip to content

Commit bd06ebc

Browse files
committed
build!: esm-only
1 parent 8c45496 commit bd06ebc

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ deno install nypm
6969
Import:
7070

7171
```js
72-
// ESM
72+
// ESM import
7373
import { addDependency } from "nypm";
7474

75-
// CommonJS
76-
const { addDependency } = require("nypm");
75+
// or dynamic import
76+
const { addDependency } = await import("nypm");
7777
```
7878

7979
### `addDependency(name, options)`

build.config.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { defineBuildConfig } from "unbuild";
2+
import { rm } from "node:fs/promises";
23

34
export default defineBuildConfig({
4-
rollup: {
5-
inlineDependencies: true
6-
}
5+
hooks: {
6+
async "build:done"() {
7+
await rm("dist/index.d.ts");
8+
},
9+
},
710
});

package.json

+2-11
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,12 @@
77
"sideEffects": false,
88
"type": "module",
99
"exports": {
10-
".": {
11-
"import": {
12-
"types": "./dist/index.d.mts",
13-
"default": "./dist/index.mjs"
14-
},
15-
"require": {
16-
"types": "./dist/index.d.cts",
17-
"default": "./dist/index.cjs"
18-
}
19-
}
10+
"types": "./dist/index.d.mts",
11+
"default": "./dist/index.mjs"
2012
},
2113
"bin": {
2214
"nypm": "./dist/cli.mjs"
2315
},
24-
"main": "./dist/index.cjs",
2516
"module": "./dist/index.mjs",
2617
"types": "./dist/index.d.ts",
2718
"files": [

0 commit comments

Comments
 (0)