-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
38 lines (31 loc) · 1.11 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
import { defineConfig } from "tsup";
import * as preset from "tsup-preset-solid";
const preset_options: preset.PresetOptions = {
// array or single object
entries: [
// default entry (index)
{
// entries with '.tsx' extension will have `solid` export condition generated
entry: "src/index.tsx",
// set `true` or pass a specific path to generate a server-only entry
server_entry: false,
},
],
// 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: true,
};
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);
}
return preset.generateTsupOptions(parsed_data);
});