Skip to content

fix(compiler): Don't strip /*# sourceURL ... */ #16088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

asnowwolf
Copy link
Contributor

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Currently, shimCssText only keep /*# sourceMappingUrl ... */ comments and strip /*# sourceURL ... */ comments. So, Chrome can't find the source maps for component style(that's created in new style tags)

What is the new behavior?

Don't strip /*# sourceURL ...*/ comments. Chrome will find source maps for component styles properly.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@asnowwolf
Copy link
Contributor Author

Sorry, the network of my home is too slow, I'll resolve the CI failure tomorrow.

@daddyschmack
Copy link

Hi Guys, how long until this get merged in? The lack of source maps is making my job MUCH more difficult.

@daddyschmack
Copy link

Guys, did the fix make it in to 4.3.3? If not, when can you implement?

@asnowwolf
Copy link
Contributor Author

@tbosch @vicb @chuckjaz What should I do more to make this PR get merged?

@@ -525,12 +530,10 @@ function stripComments(input: string): string {
return input.replace(_commentRe, '');
}

// all comments except inline source mapping
const _sourceMappingUrlRe = /\/\*\s*#\s*sourceMappingURL=[\s\S]+?\*\//;
const _commentWithHashRe = /\/\*#[\s\S]+?\*\//g;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only match what is intended ie
/\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//

const matcher = input.match(_sourceMappingUrlRe);
return matcher ? matcher[0] : '';
function extractCommentsWithHash(input: string): string[]|null {
return input.match(_commentWithHashRe);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return input.match(...) || [] and remove the null from the return type and simplify the usage

@vicb vicb added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jan 16, 2018
@vicb vicb self-assigned this Jan 16, 2018
@vicb
Copy link
Contributor

vicb commented Jan 16, 2018

@asnowwolf Sorry that it took so long. Could you please rebase and fix the comments so that we can merge it. Thanks.

@ngbot
Copy link

ngbot bot commented Jan 17, 2018

Hello? Don't want to hassle you. Sure you're busy. But this PR has some merge conflicts that you probably ought to resolve.
That is... if you want it to be merged someday...

Currently, `shimCssText` only keep `/*# sourceMappingUrl ... */` comments and strip `/*# sourceURL ... */` comments. So, Chrome can't find the source maps for component style(that's created in new `style` tags)
@vicb vicb force-pushed the dont-strip-source-url-comment branch from 8ad81c3 to 783cfcd Compare January 24, 2018 18:30
@vicb vicb added target: patch This PR is targeted for the next patch release and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 24, 2018
@vicb
Copy link
Contributor

vicb commented Jan 24, 2018

@asnowwolf I have updated your branch to fix my comments. Thanks for your initial work on this and sorry again for the delay in merging this.

@vicb vicb added the action: merge The PR is ready for merge by the caretaker label Jan 24, 2018
mhevery pushed a commit that referenced this pull request Jan 24, 2018
Currently, `shimCssText` only keep `/*# sourceMappingUrl ... */` comments and strip `/*# sourceURL ... */` comments. So, Chrome can't find the source maps for component style(that's created in new `style` tags)

PR Close #16088
@mhevery mhevery closed this in 5f681f9 Jan 24, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
Currently, `shimCssText` only keep `/*# sourceMappingUrl ... */` comments and strip `/*# sourceURL ... */` comments. So, Chrome can't find the source maps for component style(that's created in new `style` tags)

PR Close angular#16088
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
Currently, `shimCssText` only keep `/*# sourceMappingUrl ... */` comments and strip `/*# sourceURL ... */` comments. So, Chrome can't find the source maps for component style(that's created in new `style` tags)

PR Close angular#16088
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants