diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b1a608e608..07987e57ab 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -153,9 +153,9 @@ jobs: name: package path: . - # Note: We currently expect "FalseCJS" failures for Node16 + `moduleResolution: "node16" + # Note: We currently expect "FalseESM" failures for Node16 + `moduleResolution: "node16" - name: Run are-the-types-wrong - run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs + run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-esm test-published-artifact: name: Test Published Artifact ${{ matrix.example }} diff --git a/package.json b/package.json index 7a5c35f618..3adbba8018 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ ], "main": "dist/cjs/redux.cjs", "module": "dist/redux.legacy-esm.js", - "types": "dist/redux.d.ts", + "types": "dist/redux.d.mts", "exports": { "./package.json": "./package.json", ".": { - "types": "./dist/redux.d.ts", + "types": "./dist/redux.d.mts", "import": "./dist/redux.mjs", "default": "./dist/cjs/redux.cjs" } diff --git a/tsup.config.ts b/tsup.config.ts index 739de93ab9..bfffd883f0 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,7 +1,8 @@ -import { defineConfig, Options } from 'tsup' +import type { Options } from 'tsup' +import { defineConfig } from 'tsup' import * as babel from '@babel/core' -import { Plugin } from 'esbuild' +import type { Plugin } from 'esbuild' import { getBuildExtensions } from 'esbuild-extra' import fs from 'fs' @@ -41,10 +42,10 @@ export default defineConfig(options => { { ...commonOptions, format: ['esm'], - outExtension: () => ({ js: '.mjs' }), + outExtension: () => ({ js: '.mjs' }), // Add dts: '.d.ts' when egoist/tsup#1053 lands dts: true, clean: true, - onSuccess() { + async onSuccess() { // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension fs.copyFileSync('dist/redux.mjs', 'dist/redux.legacy-esm.js') }