简体   繁体   中英

How do i Import an npm Module in vue?

Basically i want to implement discord rpc in my electron browser apllication and i found this npm module for it.

I Noticed i can't import it using the default node.js way, my application just ignores it that way

const client = require('discord-rich-presence')('180984871685062656');

I Will need to import it using import (as far as i know)

import client from 'discord-rich-presence';

now my question is, how do i implement that argument in the second bracket

In your code you are importing a funcion and calling it in the same line. In ES6 you can do the same in with these two lines: first import the function, then call it.

import discordRichPresence from 'discord-rich-presence';
const client = discordRichPresence('180984871685062656');

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