4.0.0-rc.1 (2020-10-30)
- fix getters getting re-evaluated on every access (#1823) (#1860) (0006765)
- types: add lost argument of useStore (#1803) (657afe3)
3.5.1 (2020-06-29)
4.0.0-beta.4 (2020-06-29)
- types: add missing
logger.d.ts
file to the package (#1789) (a477334) - warn when unregistering non existing module (#1786) (7cec79d)
3.5.0 (2020-06-29)
4.0.0-beta.3 (2020-06-29)
- include
createLogger
function in core export (afa566d) - include logger plugin to the core export (#1783) (04e2bd8)
3.4.0 (2020-05-11)
4.0.0-beta.2 (2020-05-11)
4.0.0-beta.1 (2020-04-25)
- Added TypeScript support.
The bundles are generated as below to align with Vue 3 bundles.
vuex.global(.prod).js
- For direct use via
<script src="...">
in the browser. Exposes the Vuex global. - Note that global builds are not UMD builds. They are built as IIFEs and is only meant for direct use via
<script src="...">
. - Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the
.prod.js
files for production.
- For direct use via
vuex.esm-browser(.prod).js
- For usage via native ES modules imports (in browser via
<script type="module">
.
- For usage via native ES modules imports (in browser via
vuex.esm-bundler.js
- For use with bundlers like
webpack
,rollup
andparcel
. - Leaves prod/dev branches with
process.env.NODE_ENV
guards (must be replaced by bundler). - Does not ship minified builds (to be done together with the rest of the code after bundling).
- For use with bundlers like
vuex.cjs.js
- For use in Node.js server-side rendering via
require()
.
- For use in Node.js server-side rendering via
Vuex 4 removes its global typings for this.$store
within Vue Component due to solving issue #994. When using TypeScript, you must provide your own augment declaration.
Please place the following code in your project to have this.$store
working.
// vuex-shim.d.ts
declare module "@vue/runtime-core" {
// Declare your own store states.
interface State {
count: number
}
interface ComponentCustomProperties {
$store: Store<State>;
}
}
4.0.0-alpha.1 (2020-03-15)
This is the Vue 3 compatible version of Vuex. The focus is compatibility, and it provides the exact same API as Vuex 3, so users can reuse their existing Vuex code for Vue 3.
All Vuex 3 feature works. There are a few breaking changes described in a later section, so please check them out. You can find basic usage with both option and composition API at example
folder.
Please note that it's still unstable, and there might be bugs. Please provide us feedback if you find anything. You may use vue-next-webpack-preview to test out Vue 3 with Vuex 4.
To align with the new Vue 3 initialization process, the installation process of Vuex has changed as well.
You should use a new createStore
function to create a new store instance.
import { createStore } from 'vuex'
const store = createStore({
state () {
return {
count: 1
}
}
})
This is technically not a breaking change because you could still use
new Store(...)
syntax. However, to align with Vue 3 and also with Vue Router Next, we recommend users to usecreateStore
function instead.
Then to install Vuex to Vue app instance, pass the store instance instead of Vuex.
import { createApp } from 'vue'
import store from './store'
import App from './APP.vue'
const app = createApp(Counter)
app.use(store)
app.mount('#app')
- The code is kept as close to Vuex 3 code base as possible, and there're plenty of places where we should refactor. However, we are waiting for all of the test cases to pass before doing so (some tests require Vue 3 update).
- TypeScript support is not ready yet. Please use JS environment to test this for now.
3.4.0 (2020-05-11)
3.3.0 (2020-04-25)
- Prepend devtool handler (#1358) (a39d076), closes vuejs/vue-devtools#678
- types: Add
devtools
to store options type (#1478) (38c11dc)
- Add
prepend
option forsubscribe
andsubscribeAction
(#1358) (a39d076) - logger:
createLogger
can optionally log actions (#987) (18be128)
3.2.0 (2020-04-19)
3.1.3 (2020-03-09)
3.1.2 (2019-11-10)
- tweak mapping helper warning message (#1641) (e60bc76)
- types: avoid broadening vue instance type when using map helpers (#1639) (9a96720)
- add warnings when the different namespaced modules has the same names… (#1554) (91f3e69)
- Should vuex mapState print error message #1093 (#1297) (e5ca2d5)
- Warn about conflicts between state and module (#1365) (538ee58)
- docs: Clearify state object type (#1601) (de06f76)
3.1.1 (2019-05-08)
- Memory leak happening while using registerModule/u… (#1508) (cb9986a), closes issue#1507
- types: Make mutation and action payload optional in definition file (#1517) (0e109e2), closes #1491
- devtool: allow usage in non-browser environments (#1404) (665455f)
- esm build: build ES modules for browser (#1533) (d7c7f98)
3.1.0 (2019-01-17)
- types: add helpers to default export type declaration as in sources (#1408) (404d0de)
- types: add type annotation for the context of actions (#1322) (d1b5c66)
- types: allow a function type for root
state
option (#1132) (d39791b) - Add key to v-for (#1369) (a9bd047)
- avoid to call root state function twice (#1034) (86677eb)
- fix #1032, relax vue typing in helpers (#1044) (7c7ed1d)
- add ability to turn off devtools on vuex by passing an off options (#1407) (be75d41)
- ensure errors in action subscribers do not break actions (acd7249)
3.0.1 (2017-11-01)
3.0.0 (2017-10-11)
-
typings: It is no longer compatible with the old Vue typings
-
chore(package): bump typescript and vue core typings
-
chore: bump vue
-
Update package.json
2.5.0 (2017-10-11)
- add logger plugin logger config support (#771) (804c3bb)
- preserve state with registerModule (#837) (4c1841e)
- root actions in namespaced modules (#941) (73189eb)
- subscribeAction (#960) (a8326b1)
2.4.1 (2017-09-27)
- allow installation on extended Vue copies (c87b72f)
- link to details of mutations in components (#930) (e82782b)
- move auto installation code into the store constructor (#914) (852ac43)
2.4.0 (2017-08-29)
- typings: watch() returns an unwatch function (#922) (a4bd081)
- add missing typings and docs of createNamespacedHelpers (#910) (7ad573b)
2.3.0 (2017-04-13)
- It's no longer allowed to omit the '-loader' suffix when using loaders. You need to specify 'babel-loader' instead of 'babel'. My version of webpack: 2.2.0-rc.3 Adding the '-loader' suffix fixed the problem. Not sure though how safe it is to use 'babel-loader' instead of 'babel' with previous webpack versions...