In my ASP.NET Core Project, the following files are present:
greet.ts
export class WelcomMesssage {
name: string;
constructor(name: string) {
this.name = name;
}
say(): void {
console.log("Welcome " + this.name);
}
}
GreetExample.ts
import * as greet from "./greet";
export function Test(): void {
let g = new greet.WelcomMesssage("Bhavesh");
g.say();
}
main.ts
require.config({
baseUrl:'Scripts'
});
require(['GreetExample'], (GreetExample) => { GreetExample.Test() });
index.html
File
<!DOCTYPE html>
<html>
<head>
<title>index</title>
<script data-main="Scripts/main" src="lib/requirejs/require.js"
type="text/javascript"></script>
</head>
<body>
</body>
</html>
Upon inspecting the sources in Chrome debug tools, I noticed that my web app was serving both .ts and .js files.
https://i.sstatic.net/auoCC.png
Why is it serving both .ts and .js file? I am minifying all the javascript generated by .ts files and placing them in the wwwroot/build
folder. How do I utilize these minified files with requirejs?