Skip to content

Commit

Permalink
refactor tsup config
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Mar 27, 2024
1 parent a5256b9 commit dc531d0
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/msw-addon/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
import { defineConfig } from 'tsup'
import { defineConfig, Options } from 'tsup'

const commonOptions: Partial<Options> = {
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',
})

Expand Down

0 comments on commit dc531d0

Please sign in to comment.