Reputation: 49
I am trying to import a function called secretPhraseToPublicKey from index.js.
import {secretPhraseToPublicKey} from "./index.js";
It is giving me this error: "Uncaught SyntaxError: Unexpected token {"
I have reviewed information about import and it seems that the way I have written the import should be valid. What else would cause me to have this error?
Upvotes: 0
Views: 400
Reputation: 56720
Three things for that to work:
index.js
must have an export named secretPhraseToPublicKey
.<script>
that does the import
needs to be included in the HTML with type="module"
.Either 2. or 3. is the reason for the error message you are getting.
Upvotes: 1