I've run into this problem a million times.
I find an npm package I want to use, but it doesn't have a readme or any help on how to import it after I install it. So I try a bunch of different methods, in this case I want to use a package called react-gifplayer.
Looking through the package I see that the author exports it as Gifplayer
:
module.exports = Gifplayer
But when I try to import it I only get errors back. These are the ways I try:
import Gifplayer from 'react-gifplayer'
import { Gifplayer } from 'react-gifplayer'
const Gifplayer = require('react-gifplayer')
const Gifplayer = Npm.require('react-gifplayer')
The error I get is
SyntaxError: Unexpected reserved word
via Yeats
No comments:
Post a Comment