全局提取已弃用,未来版本将不再支持。 npm DropBox 问题

Global fetch is deprecated and will be unsupported in a future version. npm DropBox issue

我收到以下警告

Global fetch is deprecated and will be unsupported in a future version. Please pass fetch function as option when instantiating dropbox instance: new Dropbox({fetch})

警告是由以下代码产生的

import Dropbox  from 'dropbox'
var dbx = new Dropbox.Dropbox({ accessToken: dropBoxAccessToken });
dbx.filesListFolder({path: ''})

在进行此编辑时,post 还没有很好的 post,所以我 post 希望它可以节省一些时间。

解决方法是将fetch传入如下:

var dbx = new Dropbox.Dropbox({ fetch:fetch, accessToken: dropBoxAccessToken });

不再有警告或折旧问题