-
- Notifications
You must be signed in to change notification settings - Fork 6.3k
fix: support custom Global Vue alias #4070
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for submitting a PR.
Currently, it's lacking tests as well as documentation for the feature you added.
Also, your usecase, while mentioned, is not clearly layed out, so I'm not sure I understand it.
@LinusBorg I want externalize I have a bundled vue application that uses a another component that is bundled but also includes Vue. When I set I have to set this in my main.js because I bring in webcomponents built within Vue. The reason I bring Vue Web components is specifically for use inside a tinymce editor. Do you understand what I mean? |
Hey @LinusBorg
So I am revisiting this because I really need it :)
Within demo-wc.html
To elaborate further.
These are the core reasons why i need to externalize Thanks |
Hey @shaydoc Thanks for working on this and pushing it. I definitely understand the use case now as well, so thanks for that. I'll try and review this before the end of the week. Want to take some time in order to think about possible implications. |
Okay so I think the code looks fine technically. I'm still thinking about the use cases. In your specific case, I'd like to understand how the 3rd party component, which has not externalized Vue, but instead comes with it's own version bundled inside, creates issues when a global Vue instance is present? If they use their internally bundle version, I don't see how their code could care about the globally available version. Do they assign their bundled version to I ask about this as I want to make sure this actually solves a use case that is not super-rare and caused by bad practices in some other place... |
They do not assign So in my app when I set the code performing the import:
|
@LinusBorg any further thoughts on this one ? |
Actually I am building a library(more like a separate web app) for my website which both are built in vue, And I'm experiencing the same error (Cannot redefine property.. $router), Would like an update on this also |
@LinusBorg any updates on when this might be able to be merged ? |
It's already possible with the following config in module.exports = { chainWebpack: (config) => { config.externals({ vue: 'global $MyVueAlias' }) } } So no need to add a new flag. |
Adding support for customizing the Global Vue alias in WebComponent builds.
The reason for this is to avoid conflict with other components that may bundle Vue as part of their library. I am having this issue at present.