Skip to content

Commit

Permalink
Merge pull request #4512 from reduxjs/feature/more-webpack4-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Apr 3, 2023
2 parents cdc3202 + 6a2bd5f commit ad5942c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 710 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
src:
- 'src/**'
- 'test/**'
- '.github/**/*.yaml'
- 'tsup.config.ts'
build:
needs: changes
Expand Down
29 changes: 1 addition & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"Andrew Clark <acdlite@me.com> (https://github.com/acdlite)"
],
"main": "dist/cjs/redux.cjs",
"module": "dist/redux.mjs",
"module": "dist/redux.legacy-esm.js",
"types": "dist/redux.d.ts",
"exports": {
"./package.json": "./package.json",
Expand Down Expand Up @@ -56,21 +56,7 @@
"tsc": "tsc"
},
"devDependencies": {
"@babel/cli": "^7.18.10",
"@babel/core": "^7.19.0",
"@babel/eslint-parser": "^7.18.9",
"@babel/node": "^7.18.10",
"@babel/plugin-external-helpers": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.10",
"@babel/preset-env": "^7.19.0",
"@babel/preset-flow": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.18.9",
"@rollup/plugin-babel": "^6",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.0",
"@rollup/plugin-terser": "^0.4.0",
"@types/node": "^18.7.16",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
Expand All @@ -79,30 +65,17 @@
"eslint": "^8.23.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^8.0.3",
"netlify-plugin-cache": "^1.0.3",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"rollup": "^3.12.0",
"rollup-plugin-typescript2": "^0.34.1",
"rxjs": "^7.5.6",
"tsup": "^6.7.0",
"typescript": "^4.8.3",
"vitest": "^0.27.2"
},
"npmName": "redux",
"npmFileMap": [
{
"basePath": "/dist/",
"files": [
"*.js"
]
}
],
"sideEffects": false
}
7 changes: 6 additions & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig, Options } from 'tsup'
import * as babel from '@babel/core'
import { Plugin } from 'esbuild'
import { getBuildExtensions } from 'esbuild-extra'
import fs from 'fs'

// Extract error strings, replace them with error codes, and write messages to a file
const mangleErrorsTransform: Plugin = {
Expand Down Expand Up @@ -42,7 +43,11 @@ 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.mjs', 'dist/redux.legacy-esm.js')
}
},
// Browser-ready ESM, production + minified
{
Expand Down

0 comments on commit ad5942c

Please sign in to comment.