javascript - TypeScript is adding Object.defineProperty(exports, "__esModule", { value: true }); throwing an e

I have recently updated typescript at the new version 2.2.1 after this I began to receive this error on

I have recently updated typescript at the new version 2.2.1 after this I began to receive this error on the browser:

Uncaught (in promise) Error: "exports is not defined"

I noticed that typescript is adding this line after "use strict" at the began of the .js transpile file when the there is an import statement at the .ts file.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

So I re installed the previous version 2.1.6 and that line disappeared and everything works fine again.

Is this an expected behavior of this new version? How could I go throw this?

By the way I'm using SystemJS with JSPM

I have recently updated typescript at the new version 2.2.1 after this I began to receive this error on the browser:

Uncaught (in promise) Error: "exports is not defined"

I noticed that typescript is adding this line after "use strict" at the began of the .js transpile file when the there is an import statement at the .ts file.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

So I re installed the previous version 2.1.6 and that line disappeared and everything works fine again.

Is this an expected behavior of this new version? How could I go throw this?

By the way I'm using SystemJS with JSPM

Share Improve this question asked Mar 16, 2017 at 14:10 DiegoDiego 2311 gold badge4 silver badges12 bronze badges 2
  • Thanks for this question! I did the same to avoid this exports is not defined problem! Eagerly waiting for the answer. :) – Ashok M A Commented Mar 27, 2017 at 12:48
  • 1 @AshokMA I'm wondering why the angular 2 developers are not reporting this same issue... It's been a while. weird! – Diego Commented Mar 28, 2017 at 1:16
Add a ment  | 

1 Answer 1

Reset to default 5

I find the same issue. Uncaught ReferenceError: exports is not defined and require

This solution is work for me. I change the setting of "tsconfig.json"

{
  "pilerOptions": {
    "target": "es5",
    "module": "umd"
  }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742410187a4438655.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信