![](/img/trans.png)
[英]typescript and sweetalert2 Uncaught ReferenceError: exports is not defined
[英]Typescript Uncaught ReferenceError: exports is not defined
我無法弄清楚這個錯誤的含義,但我確信它可以通過另一個“簡單的破解”來解決.....因為最近與 web 技術堆棧有關的所有事情似乎都被另一個小“簡單破解”修復了“…………
我敢肯定,由於某些愚蠢的原因而出現此錯誤。
未捕獲的 ReferenceError:未定義導出
在 app.js:2
(匿名)@ app.js:2
我所做的只是導出一個 function 來測試 typescript。
核心/CoreTest.ts
export function testFunction () : void {
console.log("This is a core test");
}
然后我在這里調用它...
應用程序.ts
import { testFunction } from './core/CoreTest.js';
testFunction();
在多個網站上發布了這個問題。 歸功於這個人,我能夠解決我的問題。 https://www.reddit.com/r/typescript/comments/s5vqpj/uncaught_referenceerror_exports_is_not_defined/ht0s9x4/?context=3
tsconfig.json 中的解決方案從 commonjs 更改為 es6
“模塊”:“commonjs”
“模塊”:“es6”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.