diff --git a/tsup.config.ts b/tsup.config.ts index dcf7c4e..9e37a8c 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 = { @@ -16,13 +16,15 @@ export default defineConfig(options => { 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', - ) - }, + }, + // 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,