diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da16f07..a85cce4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -145,7 +145,7 @@ jobs: run: yarn test if: matrix.example != 'are-the-types-wrong' - - name: Run test step + - name: Run test step (attw) working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} # Ignore "FalseCJS" errors in the `attw` job run: yarn test -n FalseCJS diff --git a/package.json b/package.json index 4f2277f..bcaae10 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ ], "author": "Dan Abramov ", "main": "dist/cjs/redux-thunk.cjs", - "module": "dist/redux-thunk.mjs", + "module": "dist/redux-thunk.legacy-esm.js", "types": "dist/redux-thunk.d.ts", "exports": { "./package.json": "./package.json", diff --git a/tsup.config.ts b/tsup.config.ts index fe3e25e..22b3528 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,4 +1,5 @@ import { defineConfig, Options } from 'tsup' +import fs from 'fs' export default defineConfig(options => { const commonOptions: Partial = { @@ -14,7 +15,14 @@ export default defineConfig(options => { format: ['esm'], outExtension: () => ({ js: '.mjs' }), dts: true, - clean: 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' + ) + } }, { ...commonOptions,