简体   繁体   中英

Equivalent of a “require” statement in ES6: *.plugin(require('*'))

I have the following two statements in ES5:

var PouchDB = require("pouchdb");
PouchDB.plugin(require('pouchdb-authentication'));

I want to implement two statements in ES6 like below:

import PouchDB from 'pouchdb';
???

I don't know how to implement the second statement in ES6

I would try this first:

import PouchDB from 'pouchdb';
import PouchDBAuth from 'pouchdb-authentication';

PouchDB.plugin(PouchDBAuth);

Since import is static in ES6, you may need to give it its own line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM