Skip to content

Commit

Permalink
fix: switch to esbuild for browser based building
Browse files Browse the repository at this point in the history
  • Loading branch information
christianmat committed Mar 26, 2024
1 parent 7512c37 commit 2e58ee6
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-bugs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'remote-storage': patch
---

Switches to esbuild for browser-based building
1 change: 1 addition & 0 deletions packages/js-client/browser-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm esbuild src/index.ts --bundle --minify --target=chrome58 --minify-identifiers=false > dist/remote-storage.min.js
12 changes: 12 additions & 0 deletions packages/js-client/browser.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let { build } = require('esbuild')
let files = ['src/index.ts']

build({
entryPoints: files,
outdir: './dist',
minify: true,
bundle: true,
minifyWhitespace: true,
minifyIdentifiers: false,
target: 'chrome58',
}).catch(() => process.exit(1))
5 changes: 3 additions & 2 deletions packages/js-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"scripts": {
"dev": "tsup --watch",
"build": "tsup && tsup --config tsup.dist.config.ts && mv dist/index.min.js dist/remote-storage.min.js",
"build": "tsup && sh browser-build.sh",
"test": "jest",
"lint": "eslint --fix --ext .ts,.tsx .",
"local-release": "tsup"
Expand Down Expand Up @@ -64,6 +64,7 @@
},
"homepage": "https://github.com/FrigadeHQ/remote-storage",
"dependencies": {
"cross-fetch": "^4.0.0"
"cross-fetch": "^4.0.0",
"esbuild": "^0.20.2"
}
}
4 changes: 4 additions & 0 deletions packages/js-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export { RemoteStorage } from './core/remote-storage'
export * from './core/constants'

import { RemoteStorage } from './core/remote-storage'

globalThis.RemoteStorage = RemoteStorage
24 changes: 0 additions & 24 deletions packages/js-client/tsup.dist.config.ts

This file was deleted.

Loading

0 comments on commit 2e58ee6

Please sign in to comment.