Skip to content

Commit c403cf7

Browse files
authored
Fix webpack 4 support by setting target: es2017 for redux.legacy-esm.js (#370)
1 parent af628dd commit c403cf7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tsup.config.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig, Options } from 'tsup'
2-
import fs from 'fs'
1+
import type { Options } from 'tsup'
2+
import { defineConfig } from 'tsup'
33

44
export default defineConfig(options => {
55
const commonOptions: Partial<Options> = {
@@ -15,14 +15,16 @@ export default defineConfig(options => {
1515
format: ['esm'],
1616
outExtension: () => ({ js: '.mjs' }),
1717
dts: true,
18-
clean: true,
19-
onSuccess() {
20-
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
21-
fs.copyFileSync(
22-
'dist/redux-thunk.mjs',
23-
'dist/redux-thunk.legacy-esm.js'
24-
)
25-
}
18+
clean: true
19+
},
20+
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
21+
{
22+
...commonOptions,
23+
format: ['esm'],
24+
target: 'es2017',
25+
dts: false,
26+
outExtension: () => ({ js: '.js' }),
27+
entry: { 'redux-thunk.legacy-esm': 'src/index.ts' }
2628
},
2729
{
2830
...commonOptions,

0 commit comments

Comments
 (0)