Typescript requirejs web essentials 2.9

I am just updating websites and Typescript to the new version.

The result is that my project is no longer working.

Here is my Typescript code:

/// <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 { 

Prior to updating my generated code (which worked) was:

 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); } 

Now it looks like this:

 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); 

In my console, I have this error:

Delete error: module name "Common" has not yet been loaded for context: _. Use require ([])

I am trying to add Common to config. But before the upgrade, it works fine.

Anyone can help me, maybe something needs to change in my code in order to get my project back.

Thanks,

Jerome

UPDATE

I just see that this is related to Web Essentials 2.9, I no longer have the ability to specify a compiler option for the amd module.

I will simply remove the extension and return version 2.7:

http://vswebessentials.com/nightly/webessentials2012-2.7.vsix

+6
source share
2 answers

I would just add to this that Web Essentials really supports AMD modules in version 2.8, but this option went missing in version 2.9 - check the comments on the download page .

You will find the setting (in 2.8 or lower) in ...

Tools > Options > Web Essentials > TypeScript > "Use the AMD module"

Web Essentials TypeScript Options

+3
source

You need to compile using the amd option. those.

 tsc yourfile.ts --module "amd" 

By default, "commonjs" is used, which is the result you are currently seeing.

+1
source

Source: https://habr.com/ru/post/951065/


All Articles