Closed lokingwei closed 4 years ago
I think the issue issue may be caused when pouchdb creates a handful of files in the directory from which the app is launched:
In production, that location is unwritable as it is inside of an asar archive. You will need to find a way to have those files stored somewhere else, such as the path returned by app.getPath('userData')
.
Thanks for the response, I had added the DB path selection after build and pushed to update. Unfortunately still no luck on this.
Currently, I'm trying to debug the source for pouchdb express, it seems one stream.pipe() did not resolve. I'm wondering will it possible the require("stream")
statement are actually require the stream from browser API instead of nodejs, and there's a difference between these 2.
And also when the request is pending, the memory keep growing.
Below is my finding (updated the reproduce repo)
the allDocs()
for a clean db resolved properly, but the allDocs
content was never resolved, which lead to express-pouchdb hangs.
After my debugging, the depth I can reach is pouchdb line 5711. The unpipe
event never emitted if there is a document in the database.
}).on('unpipe', function () {
throughStream.end();
});
I suspect this has something to due with the webpack as I can run properly during serve. Is it possible cause by bundling the external module used different native module eg:require('stream')
? or any mechanism which I don't know.
Fixed this by downgrade the pouchdb version. I guess I'll file an issue in pouchdb to understand more about this behaviour...
Thanks for helping
Describe the bug I need to serve an express server(localhost:3000/) and express-pouchdb (localhost:3000/db) as the backend of electron. I already added both dependencies into externals like below:
It work properly when I serve the electron, but the path for express-pouchdb not working after build.
To Reproduce https://github.com/lokingwei/vue-cli-plugin-electron-builder-test
It has no error at all, the request just stays at pending, I can't debug what really happen. It's the same behavior for http://localhost:3000 if I remove express from externals