vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.74k stars 1.15k forks source link

build: add vue-router.esm-browser.prod.js #2242

Open skirtles-code opened 1 month ago

skirtles-code commented 1 month ago

Based on #1847.

Currently we have vue-router.esm-browser.js, but there isn't a production version of that file.

The key benefits of the newly added vue-router.esm-browser.prod.js are:

  1. It's minified.
  2. It doesn't have a dependency on @vue/devtools-api.

That second point is important, as various CDNs can automatically apply the minification, but they can't strip out the dependency on @vue/devtools-api.

The moduleSideEffects: false setting is responsible for ensuring @vue/devtools-api is removed. Without that, we end up with import "@vue/devtools-api" in the built file. See https://rollupjs.org/configuration-options/#treeshake-modulesideeffects for details of that setting. While the setting is being applied to all builds, none of the other builds are actually impacted in practice.

Do we actually need a production build for esm-browser? Not sure, but based on the comments on #1847 and #2241, it does seem that some people would find it useful. An equivalent file is already provided by both Vue Router 3 and Vue core.

Closes #1847.

netlify[bot] commented 1 month ago

Deploy Preview for vue-router canceled.

Name Link
Latest commit 79f83dcdf80829bb86a1fd916e7ca3a64345738b
Latest deploy log https://app.netlify.com/sites/vue-router/deploys/6646da5689fd5c0008e24471
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.01%. Comparing base (d6d4dd3) to head (79f83dc). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2242 +/- ## ======================================= Coverage 91.01% 91.01% ======================================= Files 24 24 Lines 1135 1135 Branches 351 351 ======================================= Hits 1033 1033 Misses 63 63 Partials 39 39 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.