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

The regex for loadChildren misses a case

ayyash opened this issue · comments

this regex to catch loadChildren var loadChildrenRegex = /loadChildren[\s]*:[\s]*['|"](.*?)['|"]/gm;
does not catch loadChildren that do not use strings, or prefix with a variable like what I do:

loadChildren: config.moduleUrl + 'modulename#ModuleName';

This is intentional. The loader is doing a string replacement, so if you're using variables or functions in the loadChildren value it's going to skip it.

why is it skipping it? whats the side effect?

The string replacement is static. Code isn't going to be evaluated before the loader does the replacement since it won't be evaluated until runtime.