我正在处理一个大型React + TypeScript
项目。
在其他同事的本地计算机上运行良好,但是在我的计算机上,我收到以下错误:
Line 1: Parsing error: Unexpected token, expected ";"
您可以在下面看到:
这里是源代码:
export type LoadOfferType = typeof import("../offers/defaultOffer");
export const loadOffer = async (): Promise<LoadOfferType> => {
const offerName = process.env.NODE_ENV === "development" ? process.env.REACT_APP_FALLBACK_SITE : "defaultOffer";
/**
* We use a switch statement instead of ane xpression for the offer path
* because Webpack throws a critical dependency error when using paths
* that are not explicitly defined.
*/
switch (offerName) {
case "mysite.com":
return await import("../offers/mysite.com");
default:
return await import("../offers/defaultOffer");
}
};
克隆存储库后我运行的命令是:
$ yarn install
$ yarn start
这里有一些有关我的系统的信息:
$ node -v
v12.13.0
$ npm -v
6.12.0
$ yarn -v
1.19.1
关于如何解决此问题的任何想法?
谢谢!