Skip to content

fix(@angular-devkit/build-angular): never use component css sourcemap… #15238

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

Merged
merged 1 commit into from
Aug 12, 2019

Conversation

filipesilva
Copy link
Contributor

… when optimizations are on.

It will just increase bundle size without offering good debug experience.

@filipesilva filipesilva added the target: patch This PR is targeted for the next patch release label Aug 2, 2019
@filipesilva filipesilva requested a review from alan-agius4 August 2, 2019 15:56
@filipesilva filipesilva requested a review from IgorMinar August 2, 2019 16:00
@filipesilva
Copy link
Contributor Author

According to @IgorMinar:

If you are building the app with build build optimizations on, we should not inline any sourcemaps at all.

The inline sourcemaps are useful for dev mode and debugging runtime issue, but don't help prod debugging easier in a way that you couldn't use devmode for and only add a lot of weight.

sourceMap: cssSourceMap
// Never use component css sourcemap when optimizations are on.
// It will just increase bundle size without offering good debug experience.
&& !buildOptions.optimization
Copy link
Collaborator

@alan-agius4 alan-agius4 Aug 2, 2019

Choose a reason for hiding this comment

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

You should actually check it style optimization is enabled. As styles optimization can be disabled.

Ie !buildOptions.optimization.styles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, and that's also what was breaking a server builder test. Thanks!

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

At the moment you are also disabling sourcemaps when opimizations are turned off.

Optimization is not a boolean but a complex object, users can choose what they want to optimize.

… when optimizations are on.

It will just increase bundle size without offering good debug experience.
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@clydin clydin left a comment

Choose a reason for hiding this comment

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

Should there be some type of information message/warning for this case? It is changing the users settings silently.

Or maybe just a warning that this is not a recommended configuration? Maybe the developer really wants the source maps?

@clydin
Copy link
Member

clydin commented Aug 2, 2019

Actually, any reason we can't create file source maps for the component stylesheets?

@filipesilva
Copy link
Contributor Author

I'm not sure if the if the AOT compiler supports non-inline css sourcemaps actually. @IgorMinar @alxhub should we use them?

@clydin
Copy link
Member

clydin commented Aug 2, 2019

Would it matter at the AOT level? It's just a different source map comment url.

@filipesilva
Copy link
Contributor Author

I vaguely remember it mattered for AOT debugging, but not sure anymore. I think that's why we always inline them.

@alan-agius4
Copy link
Collaborator

I think the problem was that when not inlining it didn’t work for a number of use cases.

  • Components styles sourcemaps didn’t work on SSR unless inlined.
  • I don’t think that client bundles can have multiple sourcemaps urls.

@clydin
Copy link
Member

clydin commented Aug 2, 2019

The bundles wouldn't. The injected style elements would each have one. Instead of a data URL they would have a file URL.

@filipesilva filipesilva removed the request for review from IgorMinar August 8, 2019 16:38
@mgechev mgechev merged commit b3b4546 into angular:master Aug 12, 2019
mgechev pushed a commit that referenced this pull request Aug 12, 2019
… when optimizations are on. (#15238)

It will just increase bundle size without offering good debug experience.
@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
target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants