I recently started learning TypeScript and decided to incorporate SystemJS for importing files. Initially, I only imported the main file that needed to be executed, which was app.js, in my index.html.
<script src="node_modules/systemjs/dist/system.js"></script>
<script>
System.import('app.js');
</script>
However, an error occurred: https://i.sstatic.net/lz7Hm.png
To address this issue, I modified my html code as follows:
<script src="node_modules/systemjs/dist/system.js"></script>
<script>
System.config({
baseURL: '/',
packages: {
"/ts": {
defaultExtension: 'js'
}
}
});
System.import('app.js');
</script>
Now, a new error has surfaced: https://i.sstatic.net/RS0k7.png
This is my package.json:
{
"name": "ts",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"jquery": "^3.4.0",
"systemjs": "^3.1.2",
"typescript": "^3.4.2"
},
"devDependencies": {
"lite-server": "^2.4.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "lite-server"
},
"author": "",
"license": "ISC"
}
In my app.ts, I have: console.log("Hello")
At this point, I am stuck. Any assistance would be greatly appreciated. Thank you in advance.