Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

getTsdownConfig.js

40 lines1.1 KB

1// @ts-check
2​
3/**
4 * @param {Object} opts - Options for building configurations.
5 * @param {string[]} opts.entry - The entry array.
6 * @returns {import('tsdown').UserConfig}
7 */
8export function modernConfig(opts) {
9 return {
10 entry: opts.entry,
11 format: ['cjs', 'esm'],
12 target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
13 // Rolldown lowers private fields for browser target arrays. Keep the
14 // transform target at ES2022 to match the syntax that tsup emitted.
15 inputOptions: { transform: { target: 'es2022' } },
16 outDir: 'build/modern',
17 dts: true,
18 fixedExtension: false,
19 sourcemap: true,
20 clean: true,
21 }
23​
24/**
25 * @param {Object} opts - Options for building configurations.
26 * @param {string[]} opts.entry - The entry array.
27 * @returns {import('tsdown').UserConfig}
28 */
29export function legacyConfig(opts) {
30 return {
31 entry: opts.entry,
32 format: ['cjs', 'esm'],
33 target: ['es2020', 'node16'],
34 outDir: 'build/legacy',
35 dts: true,
36 fixedExtension: false,
37 sourcemap: true,
38 clean: true,
39 }