brandonroberts / angular-router-loader

A Webpack loader that enables string-based module loading with the Angular Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 5 AOT compatibility

marcovdb opened this issue · comments

As of Angular 5, the NGC compiler no longer outputs TS factories, but compiles everything to JS. ES5 in my case, and in most cases, I'm sure. angular-router-loader returns a loader string that's not quite ES5 because it uses an arrow function. This is problematic because when bundling with Webpack for production, the compilation from TS to JS is done by NGC and that is not a Webpack loader. So the code substituted by angular-router-loader never gets transpiled to ES5 and you end up with a bundle that contains a tiny bit of non-ES5 code, causing UglifyJS (and IE, in case you don't minify) to fail.

Looking at the source code, it seems like an honest attempt was made at providing an ES5 version of the loader string, but maybe you just missed this one spot?