#2213·vuex

Fix type definitions with `moduleResolutions` `nodenext`

Author: ZachHaberCreated Feb 22, 2023Updated Nov 10, 2025

Hi!

Firstly, thanks for your work on this project!

Today I used patch-package to patch [email protected] for the project I'm working on.

Typescript with nodenext resolution ignores the "typings" property completely when "exports" is specified, which causes typescript to complain that it can't find any type definitions for this package.

https://github.com/microsoft/TypeScript/issues/49160#issuecomment-1137482639

This should work fine on both v3 and v4, since both have the same issue with typescript and the exports object.

Here is the diff that solved my problem:

diff
diff --git a/node_modules/vuex/package.json b/node_modules/vuex/package.json
index e8a851e..4cd1fce 100644
--- a/node_modules/vuex/package.json
+++ b/node_modules/vuex/package.json
@@ -7,7 +7,8 @@
     ".": {
       "module": "./dist/vuex.esm.js",
       "require": "./dist/vuex.common.js",
-      "import": "./dist/vuex.mjs"
+      "import": "./dist/vuex.mjs",
+      "types": "./types/index.d.ts"
     },
     "./": "./"
   },

This issue body was partially generated by patch-package.