pouchdb-community / pouchdb-all-dbs

allDbs() plugin for PouchDB
Apache License 2.0
29 stars 18 forks source link

Installation in an ember application #20

Closed DanChadwick closed 8 years ago

DanChadwick commented 8 years ago

How should this module be installed in an ember 2.0 application? I have tried both bower and npm without success. I also tried app.import() from the bower_components directory, but I cannot import the module or find it using require().

I admit that I'm not very clear how modules are resolved and imported into Ember in general. Thanks much.

nolanlawson commented 8 years ago

You should be able to npm install pouchdb-all-dbs --save and then do:

var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-all-dbs'));

Does that help? BTW this is the normal process for transpiled code, which I believe is standard for Ember 2.0 apps. Let me know if that doesn't solve the problem!

DanChadwick commented 8 years ago

Unfortunately, no. I tried that too. The require('pouchdb-all-dbs') always fails. I stepped into require() and pouchdb-all-dbs is not in the registry. I did not add the script directly with a <script> tag as I assumed that the module should be added like all the others through the build pipeline.

Note that PouchDB is in the registry if I use require(), and I can also import it with

import PouchDB from 'PouchDB';

I don't understand the ember-cli build process well enough to know what to do to import this module.

nolanlawson commented 8 years ago

You also need to npm install --save pouchdb-all-dbs. It's in the registry: https://www.npmjs.com/package/pouchdb-all-dbs

DanChadwick commented 8 years ago

Did that. And just re-did that to confirm that I wasn't deluding myself. Still not in registry. The module is in node_modules and package.json lists the dependency. Still, stepping into require, pouchdb is there, but not pouchdb-all-dbs is not. I have no clue why my installation (windows) might be different.