support custom regexp for collapse libraries

By working locally here sometimes I have node_modules installed as symbolic links, and when it happens the resolved path of the library end up being without "node_modules" in path, so I just extended the collapseLibraries to accept and use a custom regular extension to match library paths