diff --git a/tsup.config.ts b/tsup.config.ts index 22b3528..bf1678d 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,5 +1,5 @@ -import { defineConfig, Options } from 'tsup' -import fs from 'fs' +import type { Options } from 'tsup' +import { defineConfig } from 'tsup' export default defineConfig(options => { const commonOptions: Partial = { @@ -15,14 +15,16 @@ export default defineConfig(options => { format: ['esm'], outExtension: () => ({ js: '.mjs' }), dts: true, - clean: true, - onSuccess() { - // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension - fs.copyFileSync( - 'dist/redux-thunk.mjs', - 'dist/redux-thunk.legacy-esm.js' - ) - } + clean: true + }, + // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension + { + ...commonOptions, + format: ['esm'], + target: 'es2017', + dts: false, + outExtension: () => ({ js: '.js' }), + entry: { 'redux-thunk.legacy-esm': 'src/index.ts' } }, { ...commonOptions,