Skip to content

Commit

Permalink
fix: add extra build step for browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
christianmat committed Mar 26, 2024
1 parent d9e6056 commit 9d0ea6c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fifty-kings-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'remote-storage': patch
---

Adds a minified version of the library that can be included in browsers without npm
2 changes: 1 addition & 1 deletion 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",
"build": "tsup && tsup --config tsup.dist.config.ts && mv dist/index.min.js dist/remote-storage.min.js",
"test": "jest",
"lint": "eslint --fix --ext .ts,.tsx .",
"local-release": "tsup"
Expand Down
24 changes: 24 additions & 0 deletions packages/js-client/tsup.dist.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig, Options } from 'tsup'

const commonConfig: Options = {
minify: true,
dts: false,
format: ['esm', 'cjs'],
sourcemap: false,
clean: false,
minifyWhitespace: true,
}
export default defineConfig([
{
...commonConfig,
entry: ['src/index.ts'],
outDir: 'dist',
outExtension() {
return {
js: `.min.js`,
dts: `.d.ts`,
}
},
noExternal: [/(.*)/],
},
])

0 comments on commit 9d0ea6c

Please sign in to comment.