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

Update build to avoid automagically installing on window.Vue #127

Closed
Alfredo-Delgado opened this issue May 2, 2018 · 3 comments
Closed

Comments

@Alfredo-Delgado
Copy link

Portal-Vue is an excellent tool for methodically building up an application component tree on legacy web pages that may be suffering from JS spaghetti and/or state in DOM hell.

There are scenarios where a Vue instance in proper new code that's built and bundled has to co-exist with a global Vue instance loaded via a script tag.

However, portal-vue currently has code that automagically installs itself in window.Vue if window.Vue is found:

portal-vue/src/index.js

Lines 9 to 11 in cf07699

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use({ install: install })
}

There should be a build available that does not include this unwanted behavior.

@emileber
Copy link

emileber commented May 9, 2018

I did exactly that on vue-i18n: kazupon/vue-i18n#291

@LinusBorg
Copy link
Owner

Thanks @emileber - Unfortunately the stucture of this lib doesn't allow to move the install hook into some constructor.

I may have to consider separate builds.

@LinusBorg
Copy link
Owner

Will be solved in 2.0

portal-vue/src/index.ts

Lines 25 to 33 in c360bea

if (
// @ts-ignore
process.env.ROLLUP_BUILD_MODE === 'umd' &&
typeof window !== 'undefined' &&
window.Vue &&
window.Vue === Vue
) {
window.Vue.use({ install: install })
}

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

No branches or pull requests

3 participants