Skip to content
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

Don't use pre-minified Vue version #12307

Conversation

moio
Copy link
Contributor

@moio moio commented Oct 21, 2024

Summary

Fixes #12513

This changes the way scripts are minified and source maps are computed. Instead of using a pre-minified Vue version, use the full version and minify it using the existing minifier.

That moves minification after source map creation, restoring expected resource map functionality.

Occurred changes and/or fixed issues

Original With this PR
Javascript file size in dist/js 13 MB 13 MB
Source map file size in dist/js 43 MB 45 MB
Build time reported by yarn 110 s 75 s

File size change is modest, and occurs basically only in source maps which are not loaded by most users. Runtime is also shorter in my setup. All tests were run on 2.9.1.

Technical notes summary

Should be completely transparent to non-developer users.

I hope this works.

Areas or cases that should be tested

Regular test of a new Rancher version should be more than sufficient to catch any regressions, which by the way are not expected as the change uses a value that was already in place for development builds.

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

That makes source maps unreadable (function names are already minified).

Signed-off-by: Silvio Moioli <[email protected]>
@gaktive
Copy link
Member

gaktive commented Oct 21, 2024

@rak-phillip to look at this and see what needs to be ported over to 2.10.x

@richard-cox
Copy link
Member

@rak-phillip / @gaktive I'm in discussions with Silvio about this in slack. Generally looking good for 2.9 but investigating further.

ATM not sure any change is needed for 2.10 as it avoids the min version (and just uses 'vue' but i'm not sure if that's prod/dev/something else). So we need to validate 2.10 prod builds output vue fns in performance logs

Copy link
Member

@rak-phillip rak-phillip left a comment

Choose a reason for hiding this comment

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

There shouldn't be any concern for 2.10 at this point; we're not using minified builds for Vue in master.

For posterity, vue-cli-service build1 is what handles minification in our production bundles.

Footnotes

  1. https://cli.vuejs.org/guide/cli-service.html#vue-cli-service-build

@richard-cox richard-cox added this to the v2.9.5 milestone Oct 21, 2024
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

Just putting a blocker on this until we can test chunk size and functionality further.

I've also put it in to 2.9.5 to hopefully move into 2.9.4 if there's time

@moio
Copy link
Contributor Author

moio commented Oct 22, 2024

@richard-cox about chunk size: in my 2.9.1 setup js/chunk-*.js are all exactly matching (to the byte), apart from chunk-vendors.*.js which is 31001 bytes (~30 kB) longer.

@moio
Copy link
Contributor Author

moio commented Oct 24, 2024

Here is a stack trace from Chrome in the exact same situation, patched and unpatched:

Screenshot 2024-10-22 at 11 08 51
Screenshot 2024-10-22 at 11 07 31

Many more function names are now readable - unfortunately not 100% of them (despite correct names being there in the source maps, which can be read by clicking).

@moio
Copy link
Contributor Author

moio commented Oct 24, 2024

Please let me know if anything more is need from my part.

Thanks for the reviews.

Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

LGTM

  • Validated start:prod with some BVTs
  • asset size looks reasonable, checked content of old vendor chunk against new (minor minification changes
  • stack traces for vue things are now useful

Just need tests to pass (i gave a bump)... and also release-2.9 branch to track 2.9.5

Edit: More info on vue builds https://v2.vuejs.org/v2/guide/installation#Explanation-of-Different-Builds

@richard-cox
Copy link
Member

@moio i've created issues to cover the required milestones

@richard-cox richard-cox linked an issue Nov 6, 2024 that may be closed by this pull request
aruiz14 pushed a commit that referenced this pull request Nov 7, 2024
Don't use minify in souremaps
@moio moio requested a review from richard-cox November 8, 2024 13:15
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

Switching to approved. As per other PRs still blocked on release of 2.9.4 (but once that's released this can be merged)

aruiz14 pushed a commit that referenced this pull request Nov 21, 2024
Don't use minify in souremaps
@richard-cox richard-cox merged commit 36fc20d into rancher:release-2.9 Nov 21, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[backport v2.9.5] Use complete source maps for Vue
4 participants