question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Naive regex matching breaks inlining with comments

See original GitHub issue

Due to the way the inlining works with regex, when there is a comment that matches the pattern, the build fails. For example, this won’t build:

/**
@Component({
  selector: 'example',
  templateUrl: './example.component.html'
})
export class Example {
}
*/
@Component({
  selector: 'my-comp',
  template: '<div class="my-comp"></div>'
})
export class MyComponent {
}

It will fail with the following error:

Error: ENOENT: no such file or directory, open ‘/Users/user/Documents/project/src/app/comp/example.component.html’

Any chance of moving away from gulp-inline-ng2-template and into something like ts-simple-ast for inlining assets? Working with an AST would avoid this issue altogether.

Perhaps a workaround for now could be to remove comments before inlining.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dhergescommented, Nov 29, 2017

Solved by #279


@elclanrs FYI

1reaction
elclanrscommented, Oct 2, 2017

If it helps, this is how we inline assets currently, using the ts-simple-ast library: https://gist.github.com/elclanrs/c1944bf16cb8448b543872995db3ff82

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to match a lookbehind of exactly 1 or 2 line break(s) or ...
I've observed that (?s) matches even if there's no \n before. (?s) is an inline flag which turns on re.DOTALL mode so ....
Read more >
re — Regular expression operations — Python 3.11.1 ...
A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a...
Read more >
documentation - Commenting regular expressions
(If you want to match a space in a verbose regular expression, you'll need to escape it by putting a backslash in front...
Read more >
RegEx in Excel: using regular expressions in formulas - Ablebits
MultiLine - determines whether to match the pattern across line breaks in multi-line strings or only in the first line. In our codes,...
Read more >
Single-Line Comments - Regular Expressions Cookbook, 2nd ...
Just make sure the option “dot matches line breaks” is turned off when using this regular expression.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found