![](/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.