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.

Inspired by Meteor 1.7 and the fact that you can easily ship ES2015 code and legacy code side-by-side, we can enable a mode where Vue CLI produces two bundles: one for legacy browsers using the specified browserslist values, and one that targets only browsers that support <script type="module">.

  • babel-preset-env supports targets: { esmodules: true } which allows us to easily target these modern browsers.
  • We can likely extract the corresponding browsers list for autoprefixer as well.

This should allow Vue CLI users to ship a significantly smaller, and decently more performant bundle to a large percentage of end users. In Vue 2.6 we can also add a build of Vue that ships native ES2015, which can be used in this mode.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:49
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
LinusBorgcommented, Jun 12, 2019

Oh, so you changed the browserslist and applied the --modern flag?

changing the browserslist to cover only modern browsers will make webpack build a bundle that contains only modern mode without the --modern flag.

And any additional “trickery” that “modern mode” does, i.e. changing the modern bundle’s <script> elements to type="module" are not necessary as that’s just a way to make the two bundles work side-by-side - which you don’t want or need.

4reactions
larsschellhascommented, Apr 10, 2022

@ttodua it’s been a while since your question, but here is the extensive explanation: https://github.com/browserslist/browserslist#browserslistrc

TL;DR: each row is connected with an OR, therefore, "build for every browser version which has >1% market share OR the last 2 versions of a browser OR is not IE version <= 8.

I changed my file to be

> 1% and last 2 versions and not dead

This results in Vue CLI building only for modern browsers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MODERN MODE
Home · About Us · Products + -. MODERN MODE CAFÉ · MODERN MODE SELECT · MODERN MODE GOODS · Menu · 登入...
Read more >
MM
browse our vast inventory of vintage and new items. Specializing in danish modern, eames, knoll and herman miller. MM_New hours 5-18.jpg. Mode Moderne....
Read more >
Modern mode store - Instagram
12.2k Followers, 5274 Following, 188 Posts - See Instagram photos and videos from Modern mode store (@modern_mode.store)
Read more >
Modern Mode - Facebook
Modern Mode. 2941 likes. A style for every story.!
Read more >
Mode Moderne - Philadelphia, PA 19106 - 1stDibs
Mode Moderne is located in Philadelphia's historic Old City. ... Vintage 1970s American Mid-Century Modern Lounge Chairs. Materials.
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