In the process of developing a .net core mvc + angular application, I encountered an interesting situation. The MVC framework handles user management, and Angular takes over when users navigate to specific areas of the application. Initially, I integrated an Angular-2 app (stats) into the site successfully. Later on, I needed to add another functionality, so I included another Angular-2 app (practices) in the same solution without any issues. However, a transition to Angular-4 necessitated changing references, which led me to focus on the second Angular app, neglecting the first one for some time. When I attempted to run the first Angular app (stats) again after these changes, I encountered an error while the second app loaded Angular.
Both apps share common systemjs.config.js, package.json, tsconfig.json, typings.json files.
The error message:
Error: (SystemJS) exports is not defined
ReferenceError: exports is not defined
at eval (http://localhost:60660/apps/common/date.extentions.js:2:23)
...
The configuration in systemjs.config.js:
(function (global) {
// Configuration details here...
})(this);
The dependencies listed in package.json:
{
"version": "1.0.0",
"name": "asp.net",
"private": true,
"scripts": {
// Scripts info...
},
// Dependencies info...
}
tsconfig.json content:
{
// Compiler options
// Exclude details...
}
Information from typings.json:
{
"globalDependencies": {
// Global dependencies details...
}
}
date.extensions.ts code snippet:
export { }
// DATE EXTENSIONS
// ================
declare global {
interface Date {
// Date methods...
}
}
Date.prototype.addDays = function (days: number): Date {
// Add days logic here...
};
// More date extension methods...
date.extensions.js code sample:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Date.prototype.addDays = function (days) {
// Add days method details...
};
// More date extension methods...
//# sourceMappingURL=date.extentions.js.map