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

Importing vue.min.js inside es6 module doesn't work #9273

Closed
lucafabbian opened this issue Jan 1, 2019 · 5 comments
Closed

Importing vue.min.js inside es6 module doesn't work #9273

lucafabbian opened this issue Jan 1, 2019 · 5 comments

Comments

@lucafabbian
Copy link

lucafabbian commented Jan 1, 2019

Version

2.5.21

Reproduction link

https://codepen.io/lucafabbian/pen/EGbJQG?editors=1010

Steps to reproduce

Simply import vue.min.js with es6 import instead of inside a script tag

What is expected?

Vue should load as window.Vue and be available inside the page

What is actually happening?

Since inside modules windows != this (this is undefined) umd loading fails


This bug would be easily fixed replacing this with this || self in umd header.

Also refer to umdjs/umd#124

@LinusBorg
Copy link
Member

LinusBorg commented Jan 1, 2019

That build is not meant to be consumed in a module setup.

Why don't use the esm build? If you ineed Vue on window, assign it yourself.

@sqal
Copy link
Contributor

sqal commented Jan 1, 2019

Use esm build:

import Vue from 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.21/vue.esm.browser.min.js'

@yyx990803
Copy link
Member

2.6 will include dist/vue.esm.browser.min.js which is meant for direct ES6 import.

@lucafabbian
Copy link
Author

Hi!
Thanks for your answers.
I've already tried the vue.esm.browser.min.js, but it doesn't solve my problems either.
The same page works with the script tag and with with the "|| self" patch, but it doesn't with the browser es6 version: the page loads but reactivity is broken.
Exactly same code; the same issue happens both with source code and after rollup build.
Am I missing something or should I open a new issue?
I'll add a codepen as soon as possible.

@LinusBorg
Copy link
Member

it doesn't with the browser es6 version: the page loads but reactivity is broken.

Seems like a sparate issue.

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

No branches or pull requests

4 participants