Import function from module

How can I import specific function (not the default one) from a ES6 module using editor UI?
import { OAuth2Client } from 'google-auth-library';

It is probably possible to achieve it with functionExternalModules: true, requre() and global.get(), but maybe there's a more convinient way inside the editor.

Also, I'm not sure how functionExternalModules works with the new versions of Node-RED.

Try sending googleAuthLibrary to a debug node

Eg. node.warn({googleAuthLibrary})

You'll probably see it contains the OAuth2Client function/class meaning you can access it via googleAuthLibrary.OAuth2Client or const {OAuth2Client} = googleAuthLibrary


Ps, please don't tag people arbitrarily.

Legend! :star_struck:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.