Skip to content

Missed imports when transpiling in IE11 (but not in Chrome/Edge/FF) #29193

Closed
@alexi2014

Description

@alexi2014

TypeScript Version: 3.2.2
Browser: IE11

Search Terms:

Code

// Source
import * as theModule from 'someModule';
let myObj = {
    handler: () => {
        let f = function(val) {
            return theModule.someFunction();
        }
        f();
    }
};    

// Output in IE11 begins with (missed dependency, incorrect):
System.register([], function (exports_1, context_1) {
// Output in Chrome/Edge/FF begins with (dependency is present, correct):
System.register(["someModule"], function (exports_1, context_1) {

Expected behavior:
Source code is transpiled in run-time in a browser. It imports 'someModule' module, and uses a function from it (theModule.someFunction()), so the transpiled code for the System module type should reference 'someModule' in the System.register call, like here:

System.register(["someModule"], ...

Actual behavior:
This is how it works in Chrome/Edge/FF browsers, but not in IE11. In IE11 the module reference is missed, like here:

System.register([], ...

Repro sample:
Clone the following repo:
https://github.com/alexi2014/TS-IE-Missed-Import

npm install
npm run start

The page will be opened in the default browser. The top text area contains source code, and the bottom one contains transpiled code.
Depending on the browser where you open the page (Chrome/Edge/FF vs IE11), the transpiled result will be different.

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions