I have an Angular2 systemjs lazy load error for when I do a bundle for production
I have an angular2 app that uses typescript, html5 and systemjs.
When I run my lazy load modules locally it all works fine. But when I create the production files eg bundle for release. Then the lazy loading modules / routes don't work.
The app still loads and other non lazy loading routes work. But for my terms page for example I get this error in the console log:
Uncaught (in promise): TypeError: System.import is not a function
I had an attempt at updating my system.config for bundles, but to be honest I havent got a clue.
This is my attempt (system.config file):
declare var System: SystemJSLoader.System;
System.config(JSON.parse('<%= SYSTEM_CONFIG_DEV %>'));
System.config({
bundles: {
'ModuleTerms.bundle.js': ['app/components/terms/terms.module.js']
}
});
*This was for my terms and conditions page e.g. ModuleTerms. This page works fine locally, but seems to break when in the bundle and I navigate to it e.g. /terms.
I think theres some sort of setting I need to do.
Let me know if you need to see any other code.