我正在尝试从 Js 文件导出函数,但收到Unexpected token
错误
const youtubeDownload = require("./youtube/youtube-download"); // export function youtubeDownload
const twitterDonwload = require("./twitter/twitter-download"); // export function twitterDownload
function download(tweet) {
if(tweet.in_reply_to_status_id_str == null) return youtubeDownload(tweet);
if(tweet.in_reply_to_status_id_str != null) return twitterDonwload(tweet);
};
export { download };
Run Code Online (Sandbox Code Playgroud)
此代码返回错误:
export { download };
^^^^^^
SyntaxError: Unexpected token 'export'
Run Code Online (Sandbox Code Playgroud)