ReferenceError: localforage is not defined

marceloavf
5
marceloavf
commented 9 months ago

Installed @nuxtjs/localforage normally

Actual code:

  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios',
    ['@nuxtjs/localforage', {
      driver: localforage.LOCALSTORAGE,
    }]
  ],

Error:

driver: localforage.LOCALSTORAGE,
            ^

ReferenceError: localforage is not defined
    at Object.<anonymous> (D:\xampp\htdocs\suporteps-extension\nuxt.config.js:56:13)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at exports.loadNuxtConfig.argv (D:\xampp\htdocs\suporteps-extension\node_modules\nuxt\bin\common\utils.js:18:15)
    at Object.<anonymous> (D:\xampp\htdocs\suporteps-extension\node_modules\nuxt\bin\nuxt-dev:63:20)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
error An unexpected error occurred: "Command failed.
0
randyhoulahan
25
randyhoulahan
commented 2 months ago

I think you need to import/require localforage first in order to reference a driver.

0
Informations
Question โ€ข Unresolved
#c1 - Created 9 months ago