Skip to content

Commit ad5942c

Browse files
authored
Merge pull request #4512 from reduxjs/feature/more-webpack4-compat
2 parents cdc3202 + 6a2bd5f commit ad5942c

File tree

4 files changed

+31
-710
lines changed

4 files changed

+31
-710
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
src:
1717
- 'src/**'
1818
- 'test/**'
19+
- '.github/**/*.yaml'
20+
- 'tsup.config.ts'
1921
2022
build:
2123
needs: changes

package.json

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"Andrew Clark <[email protected]> (https://github.com/acdlite)"
2525
],
2626
"main": "dist/cjs/redux.cjs",
27-
"module": "dist/redux.mjs",
27+
"module": "dist/redux.legacy-esm.js",
2828
"types": "dist/redux.d.ts",
2929
"exports": {
3030
"./package.json": "./package.json",
@@ -56,21 +56,7 @@
5656
"tsc": "tsc"
5757
},
5858
"devDependencies": {
59-
"@babel/cli": "^7.18.10",
6059
"@babel/core": "^7.19.0",
61-
"@babel/eslint-parser": "^7.18.9",
62-
"@babel/node": "^7.18.10",
63-
"@babel/plugin-external-helpers": "^7.18.6",
64-
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
65-
"@babel/plugin-transform-runtime": "^7.18.10",
66-
"@babel/preset-env": "^7.19.0",
67-
"@babel/preset-flow": "^7.18.6",
68-
"@babel/preset-typescript": "^7.18.6",
69-
"@babel/register": "^7.18.9",
70-
"@rollup/plugin-babel": "^6",
71-
"@rollup/plugin-node-resolve": "^15.0.1",
72-
"@rollup/plugin-replace": "^5.0.0",
73-
"@rollup/plugin-terser": "^0.4.0",
7460
"@types/node": "^18.7.16",
7561
"@typescript-eslint/eslint-plugin": "^5.36.2",
7662
"@typescript-eslint/parser": "^5.36.2",
@@ -79,30 +65,17 @@
7965
"eslint": "^8.23.0",
8066
"eslint-config-react-app": "^7.0.1",
8167
"eslint-import-resolver-typescript": "^3.5.1",
82-
"eslint-plugin-flowtype": "^8.0.3",
8368
"eslint-plugin-import": "^2.26.0",
84-
"eslint-plugin-jsx-a11y": "^6.6.1",
8569
"eslint-plugin-react": "^7.31.8",
8670
"eslint-plugin-react-hooks": "^4.6.0",
8771
"glob": "^8.0.3",
8872
"netlify-plugin-cache": "^1.0.3",
8973
"prettier": "^2.7.1",
9074
"rimraf": "^3.0.2",
91-
"rollup": "^3.12.0",
92-
"rollup-plugin-typescript2": "^0.34.1",
9375
"rxjs": "^7.5.6",
9476
"tsup": "^6.7.0",
9577
"typescript": "^4.8.3",
9678
"vitest": "^0.27.2"
9779
},
98-
"npmName": "redux",
99-
"npmFileMap": [
100-
{
101-
"basePath": "/dist/",
102-
"files": [
103-
"*.js"
104-
]
105-
}
106-
],
10780
"sideEffects": false
10881
}

tsup.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig, Options } from 'tsup'
33
import * as babel from '@babel/core'
44
import { Plugin } from 'esbuild'
55
import { getBuildExtensions } from 'esbuild-extra'
6+
import fs from 'fs'
67

78
// Extract error strings, replace them with error codes, and write messages to a file
89
const mangleErrorsTransform: Plugin = {
@@ -42,7 +43,11 @@ export default defineConfig(options => {
4243
format: ['esm'],
4344
outExtension: () => ({ js: '.mjs' }),
4445
dts: true,
45-
clean: true
46+
clean: true,
47+
onSuccess() {
48+
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
49+
fs.copyFileSync('dist/redux.mjs', 'dist/redux.legacy-esm.js')
50+
}
4651
},
4752
// Browser-ready ESM, production + minified
4853
{

0 commit comments

Comments
 (0)