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

Plans for ES2015+ native modules/bundle-splitting? #935

Open
mismith opened this issue Sep 21, 2017 · 3 comments
Open

Plans for ES2015+ native modules/bundle-splitting? #935

mismith opened this issue Sep 21, 2017 · 3 comments

Comments

@mismith
Copy link

mismith commented Sep 21, 2017

As this recently viral article outlines, most modern browsers are now capable of handling ES2015+ syntax natively, meaning the Babel transpilation (and resulting code bloat) is not strictly necessary for many users.

How likely/possible/agreeable would be it be implement <script type="module"> support along with dist/app.min.js + dist/app.es5.min.js bundle splitting?

@mismith mismith changed the title Plans for ES2015+ native bundles? Plans for ES2015+ native modules/bundle-splitting? Sep 21, 2017
@LinusBorg
Copy link
Contributor

LinusBorg commented Sep 25, 2017

Those are two different things:

  1. Transpilation
  2. using native ES modules.

Concering 1., you can simply adjust your babel config to only support evergreen browsers, as explained in the article. since that's a very easy step, I don't hink this needs special support in the template.

About 2., there are no plans yet. I'm unaware wether webpack-html-plugin supports such a thing.

Since we recently started discussions about vue-cli 3, I think this would be something we could solve through a preset for v3, but not in this template here.

@mismith
Copy link
Author

mismith commented Sep 25, 2017

Yeah, I guess these could be seen as two parts of the same end goal. As you mention, it's currently totally possible to target only the latest browsers, but like the article mentions, the key part is doing both at the same time, much like a progressive enhancement: new browsers use the latest and greatest, old browsers use the transpiled equivalent.

vue-cli 3 sounds exciting, and maybe it is the best place for this kind of functionality to be added. I figured it would have to start at the template level instead of the cli tool level though, since this workflow would likely use webpack, and currently not all templates do.

What can I do next? Should this be discussed further or would it just need to gain popularity as an idea before anything happens?

@exarus
Copy link
Contributor

exarus commented Oct 6, 2017

@mismith the browsers can't resolve such expression:
import _ from 'lodash'
Because they don't know anything about node_modules and actually non-relative non-URL paths are currently not implemented.
So we can import lodash in these ways:
import _ from 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js'
import _ from './lodash'
Both ways are doesn't fit typical npm+webpack workflow.

BTW CSS importing is also not supported by browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
Ideas
Development

No branches or pull requests

3 participants