I am trying to start a local PouchDB database with a memory adapter mode using the package pouchdb-adapter-memory on a vue3 project.
After installing the package, I am getting this error:
Uncaught TypeError: inherits3 is not a function
When starting the vue app without the package and running PouchDB normally it dose work. Also, when trying to run PouchDB on a local server (not on the frontend) in memory mode, it dose work.
Here is an example of the usage of the package:
import PouchDB from 'pouchdb';
import PouchDBFind from 'pouchdb-find';
import PouchdbAdapterMemory from 'pouchdb-adapter-memory';
PouchDB.plugin(PouchDBFind);
PouchDB.plugin(PouchdbAdapterMemory);
class LocalDBClass {
private localDB: PouchDB.Database;
public async init(dbName: string){
this.localDB = new PouchDB(dbName, { adapter: 'memory' });
}
}
Here is a list of steps I was trying to use in order to solve the issue:
- I was trying to delete the
node_modulesdirectory and reinstall the packages usingnpm i. - I was trying to look for other ways to implement it, but all of the other solutions are using the package
pouchdb-adapter-memoryin one way or another. - I was trying to implement this solution with no success.
- I was trying to achieve my goal by using the package pouchdb-memory with no success.
- The only way I did make it work, was by import it in the
index.html(see the block of code below). It is not a good solution, because I am consuming PouchDB from an external package that I've created.
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pouchdb.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pouchdb.memory.min.js"></script>
</head>
...