-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
tsup.config.ts
40 lines (39 loc) · 973 Bytes
/
tsup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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() {
return {
js: '.min.js',
};
},
esbuildOptions(options) {
options.entryNames = 'authorizer';
},
},
]);