-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise.resolve() is not a function error angular 4 #86
Comments
To get around this problem I commented out line 3 in lib/pouch-utils.js 'use strict';
//var Promise = require('pouchdb-promise'); <-- commented out
/* istanbul ignore next */
exports.once = function (fun) { Not sure what the actual problem is, though. |
Same problem with angular 4 and ionic 2. @MrPutuLips comment helps, but it's not a good idea to comment out script :)
|
Think found where exactly issue is. So proper syntax will be
I saw there is https://github.com/59naga/babel-plugin-add-module-exports but can't setup it so it could help here. Any ideas? @lakinmohapatra did you sort out issue? |
Facing this same problem. |
We updated We like to know if this solves this issue. |
I have update version 3.0.0. But still this issue not solved. |
@Prabuganesan Thanks for testing. I will try to understand what is wrong. I don't use Angular and Ember is not showing this error so not sure where the bug is coming from. |
Here too with NextJS |
@dmitri-wm is correct. This module is not ES6 yet and should respect the fact that pouchdb-promise is. So a |
I think this is a transpile problem. Our tests wont work with .default and the browserified version in /dist should also be correct without it. But since ES6 is the future, it might be a good idea to rewrite this whole plugin and setup js:next in package.json which should help those that expect ES6 modules. Otherwise the babel plugin that @dmitri-wm mentioned seems good
But I don't know anything about angular and how it transpiles, so I'm sorry I can't help there. |
Same issue in a React project using Create React App |
This might be a silly question but can't we just rely on native promises now ? If you don't have promise support in your target build in 2018 then chances are that you are already polyfilling them earlier in your build step ? |
The only solution is changing relational-pouch/lib/pouch-utils.js line 3: var Promise = require('pouchdb-promise'); to this: var Promise = require('pouchdb-promise').default; ???? Thanks! |
Yes.... Still now not found other solution....
…On 30 April 2018 at 08:34, luca147 ***@***.***> wrote:
The only solution is changing relational-pouch/lib/pouch-utils.js line 3:
var Promise = require('pouchdb-promise');
to this: var Promise = require('pouchdb-promise')*.default*;
????
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#86 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOLoZ2Jm43keyF4WVezvhq2fPUcdYjwAks5ttn9WgaJpZM4PQGGP>
.
--
Thanks,
Prabuganesan
|
: ( very bad.... how can we work with this solution, so that all the members of the team can have that change without needing to modify it each one of them??? |
Well i decided i will not use this plugin, it have lot of bugs, i think use only pouch is more efficient. |
@luca147 You will need to create a fork of this repo and modify it yourself to have the change like what @rwein did in his fork: https://github.com/rwein/relational-pouch/commit/6b525a3ca3eea891a4a12c3b195e7c730be67e80 Then install the package using the github repo. Or simply use the fork I pointed out in the link above. This way you and all your team members should have the change. |
@509dave16 thx man, I decided not to use the plugin, as I told you in the other thread.. thx a lot |
I made a webpack alias to the browser version file. Like this:
|
@liquid36 good solution!! What it's great, no need to fork or make changes to the source code! Thx! |
@liquid36 where do you put that alias? |
Here! |
Hi guy I know it's a bit late but I have just faced the issue and base on #86 (comment). This is how I have managed:
but basicaly this is the code to put in config-overrides.js in your root folder const rewireAliases = require("react-app-rewire-aliases");
const path = require("path");
module.exports = function override(config, env) {
config = rewireAliases.aliasesOptions({
"pouchdb-promise": path.join(
__dirname,
"/node_modules/pouchdb-promise/lib/index.js"
)
})(config, env);
return config;
}; |
this works for me . if you use
|
Here's a workround: const utils = require('relational-pouch/lib/pouch-utils.js');
utils.Promise = window.Promise;
PouchDB.plugin(require('relational-pouch')); You can manully change the default |
I am using this library as
import Relational from 'relational-pouch';
PouchDB.plugin(Relational);
Its showing Promise.resolve() is not a function console error.
Please help.
The text was updated successfully, but these errors were encountered: