Skip to content

Commit 1ea8531

Browse files
committed
refactor: update thumbnail package.json to support separate builds for Node and browser environments
1 parent d670b34 commit 1ea8531

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/thumbnail/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
{
22
"name": "@nbw/thumbnail",
3-
"main": "dist/index.js",
4-
"module": "dist/index.js",
3+
"main": "dist/index.node.js",
4+
"module": "dist/index.node.js",
55
"types": "dist/index.d.ts",
66
"type": "module",
77
"private": true,
88
"exports": {
99
".": {
10-
"import": "./dist/index.js",
10+
"browser": "./dist/index.browser.js",
11+
"node": "./dist/index.node.js",
12+
"import": "./dist/index.node.js",
1113
"types": "./dist/index.d.ts",
1214
"development": "./src/index.ts"
1315
}
1416
},
1517
"scripts": {
16-
"build": "bun run clean && bun build src/index.ts --outdir dist --target node && bun run build:types",
18+
"build": "bun run clean && bun run build:node && bun run build:browser && bun run build:types",
19+
"build:node": "bun build src/index.ts --outdir dist --target node && mv dist/index.js dist/index.node.js",
20+
"build:browser": "bun build src/index.ts --outdir dist --target browser --external @napi-rs/canvas && mv dist/index.js dist/index.browser.js",
1721
"build:types": "tsc --project tsconfig.build.json",
1822
"clean": "rm -rf dist",
1923
"dev": "bun build src/index.ts --outdir dist --target node --watch",

0 commit comments

Comments
 (0)