Skip to content

Commit a5b9adc

Browse files
authored
templates: use publishConfig for the plugin template (#10196)
Separates `exports`, `main`, `types` for publish / dev with `publishConfig` for the plugin template. Previously, you needed a `dist` folder to run payload bin scripts.
1 parent 98666eb commit a5b9adc

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

templates/plugin/package.json

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
"type": "module",
77
"exports": {
88
".": {
9-
"import": "./dist/index.js",
10-
"types": "./dist/index.d.ts",
11-
"default": "./dist/index.js"
9+
"import": "./src/index.ts",
10+
"types": "./src/index.ts",
11+
"default": "./src/index.ts"
1212
},
1313
"./client": {
14-
"import": "./dist/exports/client.js",
15-
"types": "./dist/exports/client.d.ts",
16-
"default": "./dist/exports/client.js"
14+
"import": "./src/exports/client.ts",
15+
"types": "./src/exports/client.ts",
16+
"default": "./src/exports/client.ts"
1717
},
1818
"./rsc": {
19-
"import": "./dist/exports/rsc.js",
20-
"types": "./dist/exports/rsc.d.ts",
21-
"default": "./dist/exports/rsc.js"
19+
"import": "./src/exports/rsc.ts",
20+
"types": "./src/exports/rsc.ts",
21+
"default": "./src/exports/rsc.ts"
2222
}
2323
},
24-
"main": "./dist/index.js",
25-
"types": "./dist/index.d.ts",
24+
"main": "./src/index.ts",
25+
"types": "./src/index.ts",
2626
"files": [
2727
"dist"
2828
],
@@ -38,7 +38,7 @@
3838
"dev:payload": "PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
3939
"lint": "eslint ./src",
4040
"lint:fix": "eslint ./src --fix",
41-
"prepublishOnly": "pnpm clean && pnpm turbo build",
41+
"prepublishOnly": "pnpm clean && pnpm build",
4242
"test": "jest"
4343
},
4444
"devDependencies": {
@@ -81,5 +81,26 @@
8181
"engines": {
8282
"node": "^18.20.2 || >=20.9.0"
8383
},
84+
"publishConfig": {
85+
"exports": {
86+
".": {
87+
"import": "./dist/index.js",
88+
"types": "./dist/index.d.ts",
89+
"default": "./dist/index.js"
90+
},
91+
"./client": {
92+
"import": "./dist/exports/client.js",
93+
"types": "./dist/exports/client.d.ts",
94+
"default": "./dist/exports/client.js"
95+
},
96+
"./rsc": {
97+
"import": "./dist/exports/rsc.js",
98+
"types": "./dist/exports/rsc.d.ts",
99+
"default": "./dist/exports/rsc.js"
100+
}
101+
},
102+
"main": "./dist/index.js",
103+
"types": "./dist/index.d.ts"
104+
},
84105
"registry": "https://registry.npmjs.org/"
85106
}

0 commit comments

Comments
 (0)