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

False positive "loadChildren" regular expression match

pglazkov opened this issue · comments

The regular expression for replacing loadChildren matches any string in the following format:

loadChildren: 'xxx'

This causes a problem with angular-tree-component when compiling the app with AOT. This is because that component has loadChildren property property and AOT produces an ngfactory.ts file that contains loadChildren: 'loadChildren' that gets replaced by the loader causing the compilation to fail.

This can be fixed by changing the regular expression to include the # symbol (since all lazy routes seem to require the module name separated by that symbol):

loadChildren[\s]*:[\s]*['|"](.*#{1}.*)['|"]

I'll look into this soon. I'd be hesitant to force you to include the # in the loadChildren string because its not actually required. Its preferred because it works with AOT.

Closing this as the library mentioned has renamed the loadChildren property, so the conflict no longer exists.