vue-clickaway icon indicating copy to clipboard operation
vue-clickaway copied to clipboard

Do not import vue

Open simplesmiler opened this issue 8 years ago • 3 comments

Importing it may lead to bundling issues (#17), and in general is not a good idea.

Instead, receive a reference to Vue via requiring an installation step as a plugin. Probably should also auto mix the mixin during installation, while still leaving an option for avoiding this (not everybody want their namespace polluted).

This will be a breaking change, and should be released as such.

simplesmiler avatar Sep 18 '17 19:09 simplesmiler

Came here to mention this... this was the source of my headache all day lol.

Because of how I use code-splitting, a lot of my Vue components are bundled independently and loaded in dynamically. So having this plugin pull Vue in manually... is causing it to get bundled with each broken out component.. and is causing components to not load (because it's trying to pull in Vue twice).

morficus avatar Nov 28 '17 21:11 morficus

I'm willing to work on a solution and open a PR. My thought is to basically follow what the Vue docs recommend:

A Vue.js plugin should expose an install method. The method will be called with the Vue constructor as the first argument, along with possible options:

src

morficus avatar Nov 28 '17 21:11 morficus

@morficus is there any news about this? I'm currently having the same issue when adding code splitting to an app.

CraigHarley avatar Mar 06 '18 14:03 CraigHarley