簡體   English   中英

對於popper js typescript錯誤的反應應用程序構建失敗

[英]React app build failed for popper js typescript error

我有使用引導程序 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"; 之前還好。 今天出現錯誤。

這是由於 Typescript type-only-imports-and-export引入的新語法

將 package.json 中的typescript模塊package.json到 > 3.8.0 和@type定義應該可以解決此問題。

這是相關的Stackoverflow主題。

我在為 SPFx 編寫 web 部件時遇到了同樣的問題,這略有不同,但由於搜索將我帶到了這里,所以我將在未來為任何人留下答案。

雖然在運行gulp serve時將 typescript 更新為 4.4,但我得到了typescript version: 3.7.7 補救措施:

  1. 運行npm i @microsoft/rush-stack-compiler-3.9此變體選擇 TypeScript 3.9
  2. tsconfig.json更改extends"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
  3. 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM