angular-hmr-loader icon indicating copy to clipboard operation
angular-hmr-loader copied to clipboard

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

Open Swiftwork opened this issue 8 years ago • 2 comments

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 avatar Jul 31 '17 12:07 Swiftwork

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.

Swiftwork avatar Jul 31 '17 13:07 Swiftwork

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

PatrickJS avatar Aug 01 '17 18:08 PatrickJS