I've been attempting to utilize webpack's (2.2.1) async module loading as outlined in the documentation. In addition, I have explored various examples for reference.
However, I keep encountering the error message
Declaration or statement expected
, regardless of how I approach it.
It seems that the function import
is not recognized in my environment, which includes Angular 4.0.3, Angular CLI 1.0.1, and TypeScript 2.2.2.
To illustrate, here is a snippet of code I've tried:
import('./myModule').then( (myModule) => {
//Content here doesn't seem to make a difference
//The error remains consistent no matter which module I attempt to import.
});
The placement of this code doesn't seem to affect the error. While I initially wanted it within my ngOnInit
method, I have also experimented with incorporating it alongside other imports as demonstrated in the provided example.
How can I effectively use this feature? Should I be importing something additional (yes, the irony isn't lost on me)? The examples don't indicate any other requirements aside from using the feature itself.