-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsup.config.ts
47 lines (40 loc) · 1.24 KB
/
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
41
42
43
44
45
46
47
// tsup.config.ts
import { defineConfig } from 'tsup';
import * as preset from 'tsup-preset-solid';
const preset_options: preset.PresetOptions = {
// array or single object
entries: [
{
entry: 'src/package/index.ts',
server_entry: true,
},
],
// Set to `true` to remove all `console.*` calls and `debugger` statements in prod builds
drop_console: true,
// Set to `true` to generate a CommonJS build alongside ESM
cjs: false,
};
export default defineConfig((config) => {
const watching = !!config.watch;
const parsed_data = preset.parsePresetOptions(preset_options, watching);
if (!watching) {
const package_fields = preset.generatePackageExports(parsed_data);
console.log(`\npackage.json: \n${JSON.stringify(package_fields, null, 2)}\n\n`);
/*
will update ./package.json with the correct export fields
*/
preset.writePackageJson(package_fields);
}
const sd = preset.generateTsupOptions(parsed_data);
sd.forEach((r) => {
r.minify = 'terser';
r.noExternal = ['figma-squircle', 'mz-svg'];
r.external = ['solid-js'];
r.minifyWhitespace = true;
r.bundle = true;
r.clean = true;
r.minifySyntax = true;
r.minifyIdentifiers = true;
});
return sd;
});