Import/Export localForage using Vanilla ES6
Author: songfarm-davidCreated Jun 15, 2018Updated Jul 6, 2024
I would like to import the localForage library into my main script and be able to access its methods through a localForage namespace.
I've installed localforage via npm and have importing the library with the following but to no avail:
// controller.js
import localforage from "./localforage";This results in this error message:

I've also tried a more standard imports syntax:
// controller.js
import localforage from "../../node_modules/localforage/dist/localforage.js";Which returns the following error:

I don't feel confident enough to begin modifying the localForage dist file, particulary trying to define a default export (although I suppose this is one approach I could take).
Is there any built-in support for importing/exporting the localForage library using pure ES6 modules?
Thanks!
Source: localForage/localForage