Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I recently used https://www.npmjs.com/package/@freezegold/covid-19 API on VSC for use of Discord bot. It included

const virus = require('@freezegold/covid-19');

and all syntax functioned and gave me the information that I wanted. Now I want to use the same NPM on CodePen to function as website instead and when I install the exact API from their NPM installer, it shows up as this

import * as FreezegoldCovid19 from "https://cdn.skypack.dev/@freezegold/[email protected]";
virus.covid('global', (err, res) => {
  if(err) throw err
  console.log(res)
});

I am aware this new import is how ES6 works, but the error code of virus is not defined kept popping up despite me trying to figure out how to define virus, since it initially worked on my other project. Is it a syntax issue or do I need to do something else with CodePen to make this code work as it normally did using require instead of import


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...