Skip to content

how do u use this with react ? I got a "TypeError: require is not a function" #37

@gordielachance

Description

@gordielachance

Hi,
I'm building an app with React (still learning).
I've installed your package, but I don't know if I can use it with React ?

I've got this error fired :

TypeError: require is not a function

at lastfm-request.js:3

Here's a part of my code:

  import {LASTFM_API,LASTFM_API_SECRET} from "./Constants";
  import {LastFmNode} from 'lastfm';

  export class Lastfm {


    static scrobbleTrack(track): void {
      console.log("scrobbleTrack",track);

      var lastfm = new LastFmNode({
        api_key: LASTFM_API,    // sign-up for a key at http://www.last.fm/api
        secret: LASTFM_API_SECRET,
        useragent: 'appname/vX.X MyApp' // optional. defaults to lastfm-node.
      });

    }

  }

Thanks a lot !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions