I am serving my index.html from nodejs server. This ng2 file works fine with the live-server. but when I load it from nodejs index.js with specific routes it gives the following error.
Uncaught SyntaxError: Unexpected token <
VM105:17Uncaught ReferenceError: System is not defined
I have loaded the files right. Here are the loaded files:
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.16/system-polyfills.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.min.js"></script>
<script src="node_modules/angular2/bundles/angular2.min.js"></script>
<script src="node_modules/angular2/bundles/router.js"></script>
<script src="node_modules/angular2/bundles/http.js"></script>
<!-- 2. Configure SystemJS and Import -->
<script>
System.config({
packages: {
client: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('client/boot')
.then(null, console.error.bind(console));
</script>
What am I missing? All the files are served from the node server.