[英]React app build failed for popper js typescript error
I have react app that used bootstrap 4.3.1 as node modules.When i am building the app its giving below error TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types";
我有使用引导程序 4.3.1 作为节点模块的反应应用程序。当我构建应用程序时,它
TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types";
TypeScript error in /codebuild/output/src478180495/src/app-name/node_modules/@popperjs/core/lib/createPopper.d.ts(1,13): '=' expected. TS1005 > 1 | import type { OptionsGeneric, Modifier, Instance, VirtualElement } from "./types";
It was fine earlier.之前还好。 error coming up today.
今天出现错误。
It is due to a new syntax introduced by Typescript type-only-imports-and-export这是由于 Typescript type-only-imports-and-export引入的新语法
Upgrade your typescript
module in package.json
to > 3.8.0 and @type
definitions should solve this issue.将 package.json 中的
typescript
模块package.json
到 > 3.8.0 和@type
定义应该可以解决此问题。
Heres the related Stackoverflow topic.这是相关的Stackoverflow主题。
I ran into same problem while coding a web part for SPFx, which is slightly different, but since search led me here, so I'll leave the answer for anyone in the future.我在为 SPFx 编写 web 部件时遇到了同样的问题,这略有不同,但由于搜索将我带到了这里,所以我将在未来为任何人留下答案。
while updated typescript to 4.4 when running gulp serve
i got typescript version: 3.7.7
.虽然在运行
gulp serve
时将 typescript 更新为 4.4,但我得到了typescript version: 3.7.7
。 Steps to remedy:补救措施:
npm i @microsoft/rush-stack-compiler-3.9
This variant selects TypeScript 3.9npm i @microsoft/rush-stack-compiler-3.9
此变体选择 TypeScript 3.9tsconfig.json
change extends
to "extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
tsconfig.json
更改extends
到"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
tslint.json
remove "no-use-before-declare": true,
as it will cause error Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
tslint.json
中删除"no-use-before-declare": true,
因为它会导致错误Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Error - [tslint] no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.