I'm running a React JS electron app with discord-rpc
to set a presence. I copied the discord example code and put it into the top of a create-react-app
I started it and it gives me this error:
./node_modules/discord-rpc/src/client.js
Module parse failed: Unexpected token (644:8)
You may need an appropriate loader to handle this file type.
| return this.request(RPCCommands.GET_RELATIONSHIPS)
| .then((o) => o.relationships.map((r) => ({
| ...r,
| type: types[r.type],
| })));
I don't know what's going on. I tried looking it up, but I couldn't find anything. Here's my code:
import React, { Component } from 'react';
import { DiscordRPC } from 'discord-rpc'
const clientId = '821348434870403102';
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
async function setActivity() {
rpc.setActivity({
details: 'Test Details',
state: 'Teat State',
instance: false,
});
}
rpc.on('ready', () => {
setActivity();
setInterval(() => {
setActivity();
}, 15000);
});
rpc.login({ clientId }).catch(console.error);
Any help would be accepted!