Skip to content

Commit

Permalink
Fix webpack 4 support by setting target: es2017 for `redux.legacy-e…
Browse files Browse the repository at this point in the history
…sm.js` (#370)
  • Loading branch information
aryaemami59 committed Mar 22, 2024
1 parent af628dd commit c403cf7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions 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<Options> = {
Expand All @@ -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,
Expand Down

0 comments on commit c403cf7

Please sign in to comment.