I'm trying to make a Pokemon TCG library using the Pokemon TCG SDK. I already got my apiKEY and npm install the Javascript implementation on my localhost xampp.
I have my HTML like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TCG</title>
</head>
<body>
<script type="module" src="script.js"></script>
</body>
</html>
and my script.js like this:
import pokemon from 'pokemontcgsdk'
pokemon.configure({apiKey: 'myAPIkey'})
pokemon.card.find('base1-4')
.then(card => {
console.log(card.name) // "Charizard"
})
But I'm getting this error:
Failed to resolve module specifier "pokemontcgsdk". Relative references must start with either "/", "./", or "../".
I have already tried using "/", "./", or "../" on my import like the one below but it's giving me another error which is 404 error.
import pokemon from '../pokemontcgsdk'
I have a folder structure like this:
What can I do to make this work?
from Failed to resolve module specifier when importing Pokemon TCG SDK with javascript


No comments:
Post a Comment