sqlite - Ionic using PounchDB fail -


i`m testing pounchdb new app and, receive error when try execute code:

pouchdb.plugin(require('pouchdb-adapter-cordova')); _db = new pouchdb('mydb.db', {adapter: 'cordova-sqlite'}); 

erro received:

referenceerror: can't find variable: require

i follow instructions from: https://github.com/nolanlawson/pouchdb-adapter-cordova-sqlite

using ionic 1.

you're using require without associated package manager or module bundler. require not native javascript -- have include library or package app in order work.

i suggest jspm (http://jspm.io), since works systemjs , supports newest es2015 module syntax. however, understands require.

alternatively, can use browserify(http://browserify.org) bundle code (essentially browserify packs 1 file, great production!). webpack(https://webpack.github.io) great option. both of these add build step development workflow, aware of (but should have 1 anyway).


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -