kblincoe / VisualGit_SE701_2

1 stars 0 forks source link

[Issue 117] Fixed graphs not showing #144

Closed Damms closed 6 years ago

Damms commented 6 years ago

Closes: #117

This issue is caused when transpiling code with versions of Typescript 2.2 or later.

Details: The compiler emits "Object.defineProperty(exports, "esModule", { value: true });" or " exports.esmodule = true;" depending on what version of Typescript you are on. This can be seen by looking at the TypeScript source code (https://github.com/Microsoft/TypeScript/blob/bc6860428cb7f7338750ee8e77d6f405da28ec6c/src/compiler/transformers/module/module.ts#L386).

The line the compiler emits is used to check how to import packages, it's used for ES6 modules. When you import a module in ES2015 and the code is transpiled to ES5 the importee has to check if the module is an ES6 module so it can be imported accordingly.

Problem: "exports" is not defined so it throws an error and causes the graph to not load. Also, we cannot define "exports" in our .ts files as it's a reserved name by the compiler used in the top level scope of a module.

Solution: Downgrade Typescript to versions below 2.2 and re compile OR Declare "export = {};" at the top of each .ts file where you have imported packages. This is to stop the compiler from emitting "Object.defineProperty(exports, "esModule", { value: true });" or " exports.esmodule = true;" in the compiled .js file.

Damms commented 6 years ago

@softeng-701

softeng-701 commented 6 years ago

@JDamms please resolve the conflicts

Damms commented 6 years ago

@softeng-701 conflicts resolved