Skip to content

Commit

Permalink
add tsup config
Browse files Browse the repository at this point in the history
  • Loading branch information
siimsams committed Nov 28, 2023
1 parent dc80c5e commit e4515d9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineConfig } from 'tsup'
import pkg from './package.json'
const external = [...Object.keys(pkg.dependencies || {})]

export default defineConfig(() => [
{
entryPoints: ['src/index.ts'],
outDir: 'lib',
target: 'node16',
format: ['esm', 'cjs'],
clean: true,
dts: true,
minify: true,
external,
},
{
entry: { bundle: 'src/index.ts' },
outDir: 'lib',
format: ['iife'],
globalName: 'authorizerdev',
clean: false,
minify: true,
platform: 'browser',
dts: false,
name: 'authorizer',
// esbuild `globalName` option generates `var authorizerdev = (() => {})()`
// and var is not guaranteed to assign to the global `window` object so we make sure to assign it
footer: {
js: 'window.__TAURI__ = authorizerdev',
},
outExtension({ format, options }) {
return {
js: '.min.js',
}
},
esbuildOptions(options, ctx) {
options.entryNames = 'authorizer'
},
},
])

0 comments on commit e4515d9

Please sign in to comment.