Registry / database / vuex-orm-localforage

vuex-orm-localforage

JSON →
library0.3.2jsnpmunverified

A Vuex-ORM plugin (v0.3.2) that syncs Vuex Store data with IndexedDB via LocalForage. It adds Vuex actions ($fetch, $create, $update, $delete, etc.) to load and persist model data from/to IndexedDB. Supports per-model LocalForage configuration and action name customization to avoid conflicts with other Vuex-ORM plugins. Requires @vuex-orm/core ^0.36.3. Stable but rarely updated; last release 2017.

npm install vuex-orm-localforage
INSTALL
IMPORT
SIG · VUEX-ORM-LOCALFORA
V
vuex-orm-localforage
databasejavascriptv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VuexORMLocalForage
✓ import VuexORMLocalForage from 'vuex-orm-localforage'
✗ const VuexORMLocalForage = require('vuex-orm-localforage')
Default import of the plugin. No named exports. CommonJS require works but is less common in modern Vue projects.
Plugin usage
✓ VuexORM.use(VuexORMLocalForage, { database })
✗ VuexORM.use(VuexORMLocalForage, database)
Options must be wrapped in an object; passing database directly will fail because VuexORM expects a config object.
Model actions (e.g., $fetch)
✓ await Todo.$fetch()
✗ Todo.$fetch() // missing await – returns a promise, but without await the store may not be populated when you expect
All actions return promises and should be awaited. They are added to Model instances, not the global store.

Sets up VuexORM with the LocalForage plugin, registers a Todo model, and configures IndexedDB database name.

import Vue from 'vue' import Vuex from 'vuex' import VuexORM from '@vuex-orm/core' import VuexORMLocalForage from 'vuex-orm-localforage' Vue.use(Vuex) class Todo extends VuexORM.Model { static entity = 'todos' static fields() { return { id: this.increment(), title: this.string(''), done: this.boolean(false) } } } const database = new VuexORM.Database() database.register(Todo) VuexORM.use(VuexORMLocalForage, { database, localforage: { name: 'vuex-example' } }) const store = new Vuex.Store({ plugins: [VuexORM.install(database)] }) export default { store, Todo }
Debug
Known issues
deprecatedPackage has not been updated since 2017 and may be incompatible with newer versions of @vuex-orm/core.
fix
Use a modern alternative like Pinia ORM with persistence or update manually.
affects: >=0.36.3
gotchaAction names ($fetch, $create, etc.) may conflict with other Vuex-ORM plugins that introduce the same actions.
fix
Customize action names via the 'actions' option when calling VuexORM.use().
affects: >=0.1
gotchaThe plugin uses localforage defaults; if not configured, it may fall back to localStorage which has size limits.
fix
Explicitly set localforage driver: e.g., localforage: { driver: localforage.INDEXEDDB }.
affects: >=0.1
breakingRequires @vuex-orm/core version ^0.36.3. Using a newer major version may break API compatibility.
fix
Pin @vuex-orm/core to 0.36.x or check compatibility with newer versions.
affects: >=1.0.0
Errors
Common errors & fixes
VuexORM.use is not a function
VuexORM is not imported correctly or is an older version without the .use() method.
fix
Ensure you have @vuex-orm/core installed and imported: import VuexORM from '@vuex-orm/core'
Cannot read property '$fetch' of undefined
The Model class does not have actions because the plugin was not applied or database was not registered.
fix
Make sure to call VuexORM.use(VuexORMLocalForage, { database }) and register the model with database.register() before creating the store.
localforage is not defined
localforage is not a peer dependency and is bundled with the plugin, but if using a custom driver reference, it may be undefined.
fix
Use the built-in localforage via import localforage from 'localforage' if needed for driver constants.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
@vuex-orm/corerequiredPlugin is designed to extend VuexORM's database and is tightly coupled to its core API.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
vuex-orm-localforage — npm install vuex-orm-localforage · libregistry