我想让它在firebase中运行:
var FirebaseTokenGenerator = require("firebase-token-generator");
var tokenGenerator = new FirebaseTokenGenerator("<YOUR_FIREBASE_SECRET>");
var token = tokenGenerator.createToken({ uid: "1", some: "arbitrary", data: "here" });
但是我得到require is not defined error
然后切换到:
import FirebaseTokenGenerator from("firebase-token-generator");
var tokenGenerator = new FirebaseTokenGenerator("<YOUR_FIREBASE_SECRET>");
var token = tokenGenerator.createToken({ uid: "uniqueId1", some: "arbitrary", data: "here" });
我得到Uncaught SyntaxError: Unexpected token import
为什么这会失败,我是否获得了导入权?