-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtsup.config.ts
More file actions
49 lines (43 loc) · 1.3 KB
/
Copy pathtsup.config.ts
File metadata and controls
49 lines (43 loc) · 1.3 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
48
49
import { defineConfig, type Options } from 'tsup'
const NODE_TARGET: Options['target'] = ['node23']
export default defineConfig(async (options) => {
const commonConfig: Options = {
// splitting: false,
// minify: !options.watch,
// treeshake: true,
// sourcemap: true,
// clean: options.watch ? false : true,
entry: ['src/preset.ts'],
format: ['esm'],
target: 'node22',
platform: 'node',
outDir: 'dist',
clean: false,
shims: true,
external: ['vite', 'fs', 'vite-plugin-node-polyfills'],
}
const configs: Options[] = []
configs.push({
...commonConfig,
entry: ['src/preset.ts'],
format: ['esm'],
target: NODE_TARGET,
platform: 'node',
})
// Browser runtime modules. These are imported into the consumer's Storybook
// preview bundle (not the node preset), so build them for the browser and keep
// twing/drupal-attribute external — they must resolve to the consumer's copies
// (the same singletons the component render uses).
configs.push({
entry: ['src/renderer/twing.ts', 'src/renderer/twig.ts'],
format: ['esm'],
target: 'es2020',
platform: 'browser',
outDir: 'dist/renderer',
clean: false,
shims: false,
splitting: false,
external: ['twing', 'drupal-attribute'],
})
return configs
})