TypeError: t.ready is not a function
After a recent update, localforage started throwing the following error:
Uncaught (in promise) TypeError: t.ready is not a function
I use localforage as an asynchronous module, required dynamically with import().

The project's sources are here: https://github.com/lovasoa/sanipasse/
Sounds like you are doing something like:
const setItem = localForage.setItem;
setItem('something', 'something');
Can you provide a stacktrace from the non-minified sources so that we can understand more of what might be happening?
Hello !
The problem does not occur in development. It only happens after bundling (with sveltekit, that uses esbuild).
I am working around it by replacing import("localforage") by import("localforage").then(x => x.default)
https://github.com/lovasoa/sanipasse/blob/master/src/lib/storage.ts#L1-L5
Can you try reproducing after enabling sourcemaps on your production build?
I'm not sure whether the async module import might be the issue here, since we are using UMD exports.
Can you paste here what import("localforage") returns for you and whether after it returns whether window.localforage holds any value?
Does the issue happen if you use a normal ES6 import from statement?
I cannot use a simple import from in my project, because the code has to run on both node and the browser. In node, just importing localforage throws an error, without even using it at all.
I worked around the problem in my project, and I just wanted to report the bug upstream. I don't really have the time to run more experiments on this. If you want, you can reproduce the error on this commit: https://github.com/lovasoa/sanipasse/tree/f0887468f069cc682f4c3c9a1fea4bff7156f5da
index-40421e02.js:40 TypeError: l.ready is not a function
at index-40421e02.js:6:10350
at new Promise (<anonymous>)
at Module._s (index-40421e02.js:6:10328)
at Mn.storagePages (index-40421e02.js:40:47866)
at index-40421e02.js:40:75639
at Zh (index-40421e02.js:40:73781)
at xo (index-40421e02.js:40:73857)
import * as localforage from "localforage";
localforage.config({
driver: localforage.INDEXEDDB, // Force IndexedDB; same as using setDriver()
name: 'showDataDb',
storeName: 'showDataStore',
});
export default localforage;
index-40421e02.js:40 TypeError: l.ready is not a function at index-40421e02.js:6:10350 at new Promise (<anonymous>) at Module._s (index-40421e02.js:6:10328) at Mn.storagePages (index-40421e02.js:40:47866) at index-40421e02.js:40:75639 at Zh (index-40421e02.js:40:73781) at xo (index-40421e02.js:40:73857)import * as localforage from "localforage"; localforage.config({ driver: localforage.INDEXEDDB, // Force IndexedDB; same as using setDriver() name: 'showDataDb', storeName: 'showDataStore', }); export default localforage;
我也是这么写的