From dc531d0c5bfabdcf91a58bef8f7364f1fe808680 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Wed, 27 Mar 2024 09:44:00 +0100 Subject: [PATCH] refactor tsup config --- packages/msw-addon/tsup.config.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/msw-addon/tsup.config.ts b/packages/msw-addon/tsup.config.ts index d2ae949..851fdd4 100644 --- a/packages/msw-addon/tsup.config.ts +++ b/packages/msw-addon/tsup.config.ts @@ -1,56 +1,55 @@ -import { defineConfig } from 'tsup' +import { defineConfig, Options } from 'tsup' + +const commonOptions: Partial = { + outDir: './dist', + clean: true, + format: 'esm', + bundle: true, + dts: true, +} const browser = defineConfig({ + ...commonOptions, entry: { 'index.browser': './src/index.ts', }, - outDir: './dist', target: ['chrome112'], - format: 'esm', esbuildOptions(options) { options.alias = { ...(options.alias || {}), '@build-time/initialize': './src/initialize.browser.ts', } }, - bundle: true, - dts: true, tsconfig: './tsconfig.browser.json', }) const node = defineConfig({ + ...commonOptions, entry: { 'index.node': './src/index.ts', }, - outDir: './dist', target: 'node18', - format: 'esm', esbuildOptions(options) { options.alias = { ...(options.alias || {}), '@build-time/initialize': './src/initialize.node.ts', } }, - bundle: true, - dts: true, tsconfig: './tsconfig.node.json', }) const reactNative = defineConfig({ + ...commonOptions, entry: { 'index.react-native': './src/index.ts', }, - outDir: './dist', target: 'esnext', - format: 'esm', esbuildOptions(options) { options.alias = { ...(options.alias || {}), '@build-time/initialize': './src/initialize.react-native.ts', } }, - bundle: true, - dts: true, tsconfig: './tsconfig.react-native.json', })