Skip to content

Commit

Permalink
Fix tsup.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Jan 11, 2025
1 parent 0b9bf9a commit 7aa1619
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions packages/toolkit/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,10 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
format: ['esm'],
target: ['es2017'],
onSuccess: async () => {
await Promise.all(
Object.entries({
'dist/cjs': 'redux-toolkit',
'dist/react/cjs': 'redux-toolkit-react',
'dist/query/cjs': 'rtk-query',
'dist/query/react/cjs': 'rtk-query-react',
} as const).map(
async ([outDir, outputPrefix]) =>
await writeCommonJSEntry(outDir, outputPrefix),
),
)

await fs.copyFile(
'src/uncheckedindexed.ts',
path.join(outputDir, 'uncheckedindexed.ts'),
)
await writeCommonJSEntry('dist/cjs', 'redux-toolkit')
await writeCommonJSEntry('dist/react/cjs', 'redux-toolkit-react')
await writeCommonJSEntry('dist/query/cjs', 'rtk-query')
await writeCommonJSEntry('dist/query/react/cjs', 'rtk-query-react')
},
},
{
Expand Down Expand Up @@ -250,6 +238,24 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
],
format: ['cjs', 'esm'],
target: ['esnext'],
onSuccess: async () => {
// await Promise.all(
// Object.entries({
// 'dist/cjs': 'redux-toolkit',
// 'dist/react/cjs': 'redux-toolkit-react',
// 'dist/query/cjs': 'rtk-query',
// 'dist/query/react/cjs': 'rtk-query-react',
// } as const).map(
// async ([outDir, outputPrefix]) =>
// await writeCommonJSEntry(outDir, outputPrefix),
// ),
// )

await fs.copyFile(
'src/uncheckedindexed.ts',
path.join(outputDir, 'uncheckedindexed.ts'),
)
},
},
]
})
Expand Down

0 comments on commit 7aa1619

Please sign in to comment.