Jer*_*606 6 import requirejs typescript web-essentials
我只是将Web essentials和Typescript更新到新版本.
结果我的项目不再工作了.
这是我的打字稿代码:
/// <reference path="DefinitelyTyped/jqueryui.d.ts" />
/// <reference path="DefinitelyTyped/jquery-datatable.d.ts" />
import Common = module("Common");
import GMap = module("GMap");
declare var $: JQueryStatic;
export class Polygon extends GMap.Polygon {
Run Code Online (Sandbox Code Playgroud)
在更新之前,我生成的代码(有效)是:
var __extends = this.__extends || function (d, b) {
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
define(["require", "exports", "GMap", "Common"], function(require, exports, __GMap__, __Common__) {
var GMap = __GMap__;
var Common = __Common__;
var Polygon = (function (_super) {
__extends(Polygon, _super);
function Polygon() {
_super.apply(this, arguments);
}
Run Code Online (Sandbox Code Playgroud)
现在它看起来像:
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var Common = require("./Common");
var GMap = require("./GMap");
var Polygon = (function (_super) {
__extends(Polygon, _super);
Run Code Online (Sandbox Code Playgroud)
在我的控制台中我有这个错误:
未捕获错误:尚未为上下文加载模块名称"Common":_.使用require([])
我尝试在配置中添加Common.但在更新之前它工作正常.
任何人都可以帮助我,也许需要在我的代码中进行更改以恢复我的项目工作.
谢谢,
杰罗姆
UPDATE
我只是看到这是由于Web Essentials 2.9,我不再有为amd模块指定编译器选项的选项.
我只是删除扩展并安装回2.7版本:
http://vswebessentials.com/nightly/webessentials2012-2.7.vsix
您需要使用 amd 选项进行编译。IE
tsc yourfile.ts --module "amd"
Run Code Online (Sandbox Code Playgroud)
它默认为“commonjs”,这是您目前看到的输出。
| 归档时间: |
|
| 查看次数: |
1043 次 |
| 最近记录: |