How do you add localforage to the framework7 project using webpack?

Hello, I just got to know webpack. How do you add localforage to the framework7 project using webpack?

first open cmd (or terminal if you at root project and using vscode) and enter:

npm install localforage

then use it like this in for example your main.js file:

import localforage from ‘localforage’;

then:

localforage.setItem(key, data).then(data=> …).catch(error=>…)

wow, thank you very much :slight_smile:

1 Like

oh I know @Ars_Rza, this really can’t be used globally. I tried console.log localforage.driver () on the home page and got an error

it’s not recommended using modules globally but you can make it like this:

import localforage from ‘localforage’;
window.localforage = localforage;

now it’s window globally and you can do localforage.driver()