0
我編譯我的課:打字稿編譯文件
export class Test implements baseTest
編譯文件中有第一個字符串:
define(Object, ......,);
我怎麼編譯withor只定義是這樣的:
var Test = (function(){..})();
我編譯我的課:打字稿編譯文件
export class Test implements baseTest
編譯文件中有第一個字符串:
define(Object, ......,);
我怎麼編譯withor只定義是這樣的:
var Test = (function(){..})();
刪除export
關鍵字。當你想要全局代碼時,你正試圖創建一個模塊。
我相信這是由您的tsconfig.json文件的'compilerOptions.module'屬性定義的。它根據你選擇的選項不同地編譯你的模塊。嘗試將其設置爲「CommonJS」。 [https://www.typescriptlang.org/docs/handbook/compiler-options.html] – mhodges
它也可以與'compilerOptions.target'屬性結合使用。嘗試定位「ES5」。您可能需要使用不同的組合。 – mhodges
僅用於class ||功能 –