4

Does anyone know what is the fix for the decricated import of ionic Plugins?

I'm following a tutorial and I cant proceed until I fix it..

import { Plugins } from '@capacitor/core';
import { Storage} = Plugins;

Many thanks

Wesley Masunika
  • 153
  • 2
  • 10

1 Answers1

4

Do you mean what is the new way of importing plugins? I assume you mean previously we used to do something similar to:

import { Plugins } from '@capacitor/core';
import { MyImport } = Plugins;

If that is the question you're asking, then Capacitor 3 now uses modulated plugins so they're all independent of each other.

You now import them directly, e.g:

import { Storage } from '@capacitor/storage';

Available Capacitor plugins are here.

Capacitor 4:

Capacitor Storage has now been renamed to Preferences in Capacitor 4.

So your new code would look like this:

import { Preferences } from '@capacitor/preferences';
Super_Simon
  • 1,250
  • 8
  • 25