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

feat: add browser ESM build #7110

Closed
wants to merge 1 commit into from
Closed

feat: add browser ESM build #7110

wants to merge 1 commit into from

Conversation

yyx990803
Copy link
Member

Adding a new dist file vue.esm.browser.js which enables direct import in ESM-enabled browsers:

<script type="module">
import Vue from 'https://unpkg.com/vue/dist/vue.esm.browser.js'

new Vue({
  el: '#app',
  data: {
    msg: 'hello!'
  }
})
</script>

@codecov-io
Copy link

codecov-io commented Nov 22, 2017

Codecov Report

Merging #7110 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #7110   +/-   ##
====================================
  Coverage   100%    100%           
====================================
  Files        99      99           
  Lines      4081    3999   -82     
====================================
- Hits       4081    3999   -82
Impacted Files Coverage Δ
src/core/util/props.js 100% <0%> (ø) ⬆️
src/platforms/web/compiler/directives/model.js 100% <0%> (ø) ⬆️
src/core/util/env.js 100% <0%> (ø) ⬆️
src/core/observer/traverse.js 100% <0%> (ø) ⬆️
src/compiler/codegen/events.js 100% <0%> (ø) ⬆️
src/core/vdom/create-element.js 100% <0%> (ø) ⬆️
src/core/instance/render.js 100% <0%> (ø) ⬆️
src/compiler/to-function.js 100% <0%> (ø) ⬆️
src/core/global-api/extend.js 100% <0%> (ø) ⬆️
src/core/vdom/create-functional-component.js 100% <0%> (ø) ⬆️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62a922e...6b74faf. Read the comment docs.

@tvanier
Copy link

tvanier commented May 11, 2018

Thanks @yyx990803 , the new vue.esm.browser.js looks good, should it be mentioned in dist/README.md?
Is it expected the new dist file is already included in the vue package (before this PR is merged)?
https://unpkg.com/vue@2.5.16/dist/vue.esm.browser.js
dist/vue.esm.browser.js seems to exist since version 2.5.9, and its internal version is always 2.5.8?

@damianpeterson
Copy link

Is this meant to be for development only? I see things like productionTip: "development" !== 'production' in the compiled file.

@simonhaenisch
Copy link

simonhaenisch commented Jun 3, 2018

Having the same question as @damianpeterson: will you add a vue.esm.browser.min.js production build as well?

from https://github.com/vuejs/vue/tree/dev/dist#development-vs-production-mode:

CommonJS and ES Module builds are intended for bundlers, therefore we don't provide minified versions for them. You will be responsible for minifying the final bundle yourself.

But with ESM in the browser we won't necessarily need bundlers anymore (depending on the project and its audience). For what I'm working on, I don't need template pre-compilation and runtime-only, but I would prefer a minified version (vue.min.js is 84 KB versus 284 KB unminified).

@TimvdLippe
Copy link

I am already using this bundle in my project and can say that is working as expected. I am not sure why this file is already available after npm install vue, but I can't complain 😄

@megacromulent
Copy link

Is there a way we could get a beta build of the esm browser version of this for internal testing purposes? (ie, as beta testers perhaps?)

@yyx990803 yyx990803 changed the base branch from dev to 2.6 December 5, 2018 22:40
@yyx990803
Copy link
Member Author

yyx990803 commented Dec 5, 2018

Landed as f2fd44b

@yyx990803 yyx990803 closed this Dec 5, 2018
@zigomir
Copy link
Contributor

zigomir commented Jan 11, 2019

Seems like latest versions aren't published as ES modules anymore. Opening Vue.js https://unpkg.com/vue@2.5.21/dist/vue.esm.browser.js says it's a v2.5.8 but should be 2.5.21, right?

Or is it only wrong comment "banner"? I believe using this build with dev tools also picked 2.5.8.

@yyx990803
Copy link
Member Author

@zigomir these files were actually published by mistake - they were built on a different branch and accidentally published. Actual ESM browser build won't land until 2.6.

@zigomir
Copy link
Contributor

zigomir commented Jan 12, 2019

I see. Thanks!

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

Successfully merging this pull request may close these issues.

8 participants