我试图在纯 JavaScript 中使用类,所以我面临错误“未捕获的语法错误:无法在module外使用导入语句”并且无法解决它。
File1.js - 主文件
import example from "./file2";
var test = new example();
File2.js - 类文件
export default class example {
constructor() {
console.log("hello world");
}
}