Looking at this Typescript code:
(()=> {
console.log('called boot'); // 'called boot'
})();
The resulting JavaScript is:
(function () {
console.log('called boot');
})();
define("StockMarketService", ["require", "exports", "jquery"], function(require, exports, $) {
"use strict";
var StockMarketService = (function (_super) {
__extends(StockMarketService, _super);
... additional code omitted ...
return StockMarketService;
}(Riot.Observable));
exports.StockMarketService = StockMarketService;
});
Contrast this with the Typescript import:
import {StockMarketService} from "./services/stockmarket-service";
(()=> {
console.log('called boot'); //NOTHING HAPPENS.
})();
Which leads to the following JS:
define("StockMarketService", ["require", "exports", "jquery"], function(require, exports, $) {
"use strict";
var StockMarketService = (function (_super) {
__extends(StockMarketService, _super);
... additional code omitted ...
return StockMarketService;
}(Riot.Observable));
exports.StockMarketService = StockMarketService;
});
define(["require", "exports"], function (require, exports) {
"use strict";
(function () {
console.log('called boot');
})();
});
In the second version, the Immediately Invoked Function Expression no longer functions as expected. This IIFE serves as the entry point to the application and is not a module. The goal is simply to execute the IIFE. All dependencies are consolidated in one file that needs to be referenced and used.
What could be causing this issue?