PatrickJS / angular-hmr-loader

:fire: Angular HMR Webpack Loader by @AngularClass
http://bit.ly/angular-class
Apache License 2.0
32 stars 6 forks source link

[BUG] Does not match bootstrapModule if it contains multiline compilerOptions #10

Open Swiftwork opened 7 years ago

Swiftwork commented 7 years ago

Line index.js#L3 will not match multiline compilerConfig.

.bootstrapModule(AppModule, {
    defaultEncapsulation: ViewEncapsulation.None,
})

will match

.bootstrapModule(AppModule, { defaultEncapsulation: ViewEncapsulation.None })

Could you update the RegExp to reflect the angular documentation?

Swiftwork commented 7 years ago

This might work, but needs testing with nested config objects that look similar.

/(\.bootstrapModule|\.bootstrapModuleFactory)\((.+|.+, ?[\[\{][\S\s]*[\]\}])?\)/gm

But a better solution would be to loop though and count opening / closing brackets.

PatrickJS commented 7 years ago

can you make a PR and provide a link to regex101.com with examples