Promise does not work in RC 2

Hi Devs!

I built my app with ionic 2 beta in which i uses promises to return e.g. LocalStorage data or http response data. Now i upgraded to RC2 and suddenly the promise.es2015.lib is not found - can somebody please help me with this?

I also noticed that LocalStorage was removed? What is the best option to use in future?

Greetings Daniel

The best idea for storage is currently the new Ionic Storage package. This package will try to use the best available database in this order:

Currently the ordering is SQLite, IndexedDB, WebSQL, and LocalStorage.

Regarding promise.es2015.lib, maybe this has to do with changes in the build system that were recently introduced. Try to start a fresh app using the current RC2 and see if you can import your lib.

Otherwise, why not simply use the HTTP requests with Angular 2 as they are? There’s no reason top change that behaviour (in general).

first of all, thanks for the reply.

I have another question to Ionic Storage - i have installed it on one of my ionic 2 beta apps - when i say “ionic build ios” i get the following error message:

import { Storage } from ‘./storage’;
ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’

Can you please help me on this - i really love the idea of IonicStorage.


To import storage use the code below
import { Storage } from ‘@ionic/storage’;

Try it on a fresh starter project. If that works, there’s something janky with your project’s configuration files. Generally speaking, when that happens, it’s often easier to parachute your code into a new project than it is to figure out what bits of what config files need to be tweaked.

I am using the code you mentioned. The line "import { Storage } from ‘./storage’; is line 1 from index.js in the /node_modules/@ionic/storage/es2015/ folder

In my code im using: import { Storage } from ‘@ionic/storage’;

Thank you - I will give it a try. :relieved: