Repository navigation
Expand file tree
/
Copy pathtsdown.size.config.ts
More file actions
47 lines (45 loc) · 1.58 KB
/
Copy pathtsdown.size.config.ts
File metadata and controls
47 lines (45 loc) · 1.58 KB
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
// Minified throwaway builds used only by `scripts/size.mjs` to measure realistic gzip sizes.
import { defineConfig, type UserConfig } from 'tsdown'
import solid from 'unplugin-solid/rolldown'
const production: UserConfig = {
platform: 'browser',
target: 'es2022',
format: 'esm',
minify: true,
dts: false,
publint: false,
attw: false,
plugins: [
solid({ solid: { generate: 'dom', hydratable: true } }),
// What a production build sees: solid-js/web's `isDev` is `false`, so the diagnostics fold away.
{
name: 'production-dev',
resolveId: (id) => (id === './dev' ? '\0dev' : null),
load: (id) =>
id === '\0dev'
? 'export const DEV = false; export const warn = () => {}; export const explain = () => ""'
: null,
},
],
}
export default defineConfig([
// The published entries, chunked the way they ship.
{
...production,
entry: { index: 'src/index.ts', router: 'src/router.tsx', navigation: 'src/navigation.tsx' },
outDir: '.size',
outputOptions: { chunkFileNames: 'shared.js' },
},
// One import at a time, tree-shaken on its own: catches the core dragging in the components,
// and measures what the two drop-in bars really cost.
...Object.entries({
'createProgress-only': 'scripts/size-entries/create-progress.ts',
'RouteProgress-only': 'scripts/size-entries/route-progress.ts',
'NavigationProgress-only': 'scripts/size-entries/navigation-progress.ts',
}).map(([name, file]): UserConfig => ({
...production,
entry: { [name]: file },
outDir: '.size-exports',
clean: false,
})),
])