MyGit

v3.0.0-alpha.3

reduxjs/redux-thunk

版本发布时间: 2023-04-04 01:43:24

reduxjs/redux-thunk最新发布版本:v3.1.0(2023-12-04 21:57:13)

This is an alpha release for Redux-Thunk 3.0. This release has many changes to our build setup and published package contents.

Also see the release notes for redux@5.0.0-alpha.4.

Changelog

ESM/CJS Package Compatibility

The biggest theme of the Redux v5 and RTK 2.0 releases is trying to get "true" ESM package publishing compatibility in place, while still supporting CJS in the published package.

Earlier alphas made changes to the package.json contents and published build artifacts in an attempt to get ESM+CJS compat working correctly, but those alphas had several varying compat issues.

We've set up a battery of example applications in the RTK repo that use a variety of build tools (currently CRA4, CRA5, Next 13, and Vite, Node CJS mode, and Node ESM mode), to verify that Redux and Redux Toolkit compile, import, and run correctly with both TS and various bundlers. We've also set up a check using a custom CLI wrapper around https://arethetypeswrong.github.io to check for potential packaging incompatibilities.

This release changes the names and contents of the published build artifacts, and the various exports/module/main fields in package.json to point to those.

The primary build artifact is now an ESM file, dist/redux-thunk.mjs. Most build tools should pick this up. There's also a CJS artifact, and a second copy of the ESM file named redux-thunk.legacy-esm.js to support Webpack 4 (which does not recognize the exports field in package.json).

As of this release, we think we have ESM+CJS compat working correctly, but we ask that the community try out the alphas in your apps and let us know of any compat problems!

Note: The one known potential issue is that TypeScript's new moduleResolution: "node16" mode may see a mismatch between the ESM artifacts and the TS typedefs when imported in a Node CJS environment, and [that may allow hypothetically-incorrect import usage. (See ongoing discussion in https://github.com/arethetypeswrong/arethetypeswrong.github.io/issues/21 .) In practice, we think that probably won't be a concern, and we'll do further investigation before a final release.

Build Tooling

We're now building the package using https://github.com/egoist/tsup . It looks like the output is effectively equivalent, but please let us know if there's any issues.

We also now include sourcemaps for the ESM and CJS artifacts.

The repo has been updated to use Yarn 3 for dependencies and Vitest for running tests.

Dropping UMD Builds

Redux has always shipped with UMD build artifacts. These are primarily meant for direct import as script tags, such as in a CodePen or a no-bundler build environment.

For now, we're dropping those build artifacts from the published package, on the grounds that the use cases seem pretty rare today.

Since the code is so simple, the ESM artifact can be used directly in the browser via Unpkg.

If you have strong use cases for us continuing to include UMD build artifacts, please let us know!

What's Changed

Full Changelog: https://github.com/reduxjs/redux-thunk/compare/v3.0.0-alpha.1...v3.0.0-alpha.3

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-04-04发行的版本